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

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

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

            ElGamalParameters other = obj as ElGamalParameters;

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

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