init method

  1. @override
void init(
  1. bool forSigning,
  2. CipherParameters params
)
override

Init this Signer. The params argument can be: -A ParametersWithRandom containing a PrivateKeyParameter or a raw PrivateKeyParameter for signing -An PublicKeyParameter for verifying.

Implementation

@override
void init(bool forSigning, CipherParameters params) {
  _pbkey = _pvkey = null;

  if (forSigning) {
    PrivateKeyParameter pvparams;

    if (params is ParametersWithRandom) {
      _random = params.random;
      pvparams = params.parameters as PrivateKeyParameter<PrivateKey>;
    } else if (_kMac != null) {
      _random = null;
      pvparams = params as PrivateKeyParameter<PrivateKey>;
    } else {
      _random = SecureRandom();
      pvparams = params as PrivateKeyParameter<PrivateKey>;
    }

    _pvkey = pvparams.key as ECPrivateKey;
  } else {
    PublicKeyParameter pbparams;

    pbparams = params as PublicKeyParameter<PublicKey>;

    _pbkey = pbparams.key as ECPublicKey;
  }
}