상속: AsymmetricKeyParameter
예제 #1
0
		/**
		* 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.");
				}
			}
		}
예제 #2
0
        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));
 }
예제 #5
0
		protected bool Equals(
			ElGamalKeyParameters other)
		{
			return Platform.Equals(parameters, other.parameters)
				&& base.Equals(other);
		}
예제 #6
0
 protected bool Equals(
     ElGamalKeyParameters other)
 {
     return(Platform.Equals(parameters, other.parameters) &&
            base.Equals(other));
 }
예제 #7
0
 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));