public ParametersWithRandom( ICipherParameters parameters, SecureRandom random) { if (parameters == null) throw new ArgumentNullException("random"); if (random == null) throw new ArgumentNullException("random"); this.parameters = parameters; this.random = random; }
public void Init( bool forEncryption, ICipherParameters parameters) { AsymmetricKeyParameter kParam; if (parameters is ParametersWithRandom) { ParametersWithRandom rParam = (ParametersWithRandom)parameters; this.random = rParam.Random; kParam = (AsymmetricKeyParameter)rParam.Parameters; } else { this.random = new SecureRandom(); kParam = (AsymmetricKeyParameter)parameters; } engine.Init(forEncryption, parameters); this.forPrivateKey = kParam.IsPrivate; this.forEncryption = forEncryption; }