Example #1
0
 public ElGamalKeyGenerationParameters(
     SecureRandom random,
     ElGamalParameters parameters)
     : base(random, GetStrength(parameters))
 {
     this.parameters = parameters;
 }
Example #2
0
 protected ElGamalKeyParameters(
     bool isPrivate,
     ElGamalParameters parameters)
     : base(isPrivate)
 {
     // TODO Should we allow 'parameters' to be null?
     this.parameters = parameters;
 }
Example #3
0
        public ElGamalPublicKeyParameters(
            BigInteger y,
            ElGamalParameters parameters)
            : base(false, parameters)
        {
            if (y == null)
            {
                throw new ArgumentNullException("y");
            }

            this.y = y;
        }
Example #4
0
        public ElGamalPrivateKeyParameters(
            BigInteger x,
            ElGamalParameters parameters)
            : base(true, parameters)
        {
            if (x == null)
            {
                throw new ArgumentNullException("x");
            }

            this.x = x;
        }
Example #5
0
        public override bool Equals(
            object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            ElGamalParameters other = obj as ElGamalParameters;

            if (other == null)
            {
                return(false);
            }

            return(Equals(other));
        }
Example #6
0
 protected bool Equals(
     ElGamalParameters other)
 {
     return(p.Equals(other.p) && g.Equals(other.g) && l == other.l);
 }
Example #7
0
 internal static int GetStrength(
     ElGamalParameters parameters)
 {
     return(parameters.L != 0 ? parameters.L : parameters.P.BitLength);
 }