Beispiel #1
0
        public override bool Equals(Object obj)
        {
            if (obj is DHParameters)
            {
                DHParameters dhP = (DHParameters)obj;
                // Check for Q.
                if (q == null)
                {
                    if (dhP.getQ() != null)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!q.Equals(dhP.getQ()))
                    {
                        return(false);
                    }
                }

                if (dhP.getJ() != j)
                {
                    return(false);
                }

                if (validation == null)
                {
                    if (dhP.getValidationParameters() != null)
                    {
                        return(false);
                    }
                }
                else
                {
                    if (!validation.Equals(dhP.getValidationParameters()))
                    {
                        return(false);
                    }
                }

                return(dhP.getG().Equals(g) && dhP.getP().Equals(p));
            }

            return(base.Equals(obj));
        }
Beispiel #2
0
 public DHKeyGenerationParameters(
     SecureRandom random,
     DHParameters parameters) : base(random, parameters.getP().bitLength() - 1)
 {
     this.parameters = parameters;
 }