init method

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

Init the generator with its initialization params. The type of CipherParameters depends on the algorithm being used (see the documentation of each implementation to find out more).

Implementation

@override
void init(CipherParameters params) {
  if (params is ParametersWithRandom) {
    _random = params.random;
    _params = params.parameters as RSAKeyGeneratorParameters;
  } else {
    _random = SecureRandom();
    _params = params as RSAKeyGeneratorParameters;
  }

  if (_params.bitStrength < 12) {
    throw ArgumentError('key bit strength cannot be smaller than 12');
  }

  if (!_testBit(_params.publicExponent, 0)) {
    throw ArgumentError('Public exponent cannot be even');
  }
}