init method

  1. @override
void init(
  1. CipherParameters params
)
override

Initialize the encryptor.

Implementation

@override
void init(CipherParameters params) {
  AsymmetricKeyParameter akparams;
  if (params is ParametersWithRandom) {
    akparams = params.parameters as AsymmetricKeyParameter<AsymmetricKey>;
    _random = params.random;
  } else {
    akparams = params as AsymmetricKeyParameter<AsymmetricKey>;
    _random = _newSecureRandom();
  }
  var k = akparams.key as ECAsymmetricKey;
  if (k is! ECPublicKey) {
    throw ArgumentError('ECPublicKey is required for encryption.');
  }
  _key = k;
}