/** * initialise the ElGamal engine. * * @param forEncryption true if we are encrypting, false otherwise. * @param param the necessary ElGamal key parameters. */ public virtual void Init( bool forEncryption, ICipherParameters parameters) { if (parameters is ParametersWithRandom) { ParametersWithRandom p = (ParametersWithRandom) parameters; this.key = (ElGamalKeyParameters) p.Parameters; this.random = p.Random; } else { this.key = (ElGamalKeyParameters) parameters; this.random = new SecureRandom(); } this.forEncryption = forEncryption; this.bitSize = key.Parameters.P.BitLength; if (forEncryption) { if (!(key is ElGamalPublicKeyParameters)) { throw new ArgumentException("ElGamalPublicKeyParameters are required for encryption."); } } else { if (!(key is ElGamalPrivateKeyParameters)) { throw new ArgumentException("ElGamalPrivateKeyParameters are required for decryption."); } } }
public override bool Equals(object obj) { if (obj == this) { return(true); } ElGamalKeyParameters elGamalKeyParameters = obj as ElGamalKeyParameters; return(elGamalKeyParameters != null && this.Equals(elGamalKeyParameters)); }
public override bool Equals(object obj) { if (obj == this) { return(true); } ElGamalKeyParameters other = obj as ElGamalKeyParameters; if (other == null) { return(false); } return(this.Equals(other)); }
protected bool Equals( ElGamalKeyParameters other) { return(Org.BouncyCastle.Utilities.Platform.Equals(parameters, other.parameters) && base.Equals(other)); }
protected bool Equals( ElGamalKeyParameters other) { return Platform.Equals(parameters, other.parameters) && base.Equals(other); }
protected bool Equals( ElGamalKeyParameters other) { return(Platform.Equals(parameters, other.parameters) && base.Equals(other)); }
protected bool Equals(ElGamalKeyParameters other) { return(Object.Equals(_parameters, other.Parameters) && base.Equals(other)); }
protected bool Equals(ElGamalKeyParameters other) { return Object.Equals(_parameters, other.Parameters) && base.Equals(other); }
protected bool Equals(ElGamalKeyParameters other) => (object.Equals(this.parameters, other.parameters) && base.Equals((AsymmetricKeyParameter)other));