SelectGenerator() static private méthode

static private SelectGenerator ( BigInteger p, BigInteger q, SecureRandom random ) : BigInteger
p Org.BouncyCastle.Math.BigInteger
q Org.BouncyCastle.Math.BigInteger
random Org.BouncyCastle.Security.SecureRandom
Résultat Org.BouncyCastle.Math.BigInteger
        public virtual DHParameters GenerateParameters()
        {
            BigInteger[] array = DHParametersHelper.GenerateSafePrimes(size, certainty, random);
            BigInteger   p     = array[0];
            BigInteger   q     = array[1];
            BigInteger   g     = DHParametersHelper.SelectGenerator(p, q, random);

            return(new DHParameters(p, g, q, BigInteger.Two, null));
        }
Exemple #2
0
        public ElGamalParameters GenerateParameters()
        {
            BigInteger[] array = DHParametersHelper.GenerateSafePrimes(this.size, this.certainty, this.random);
            BigInteger   p     = array[0];
            BigInteger   q     = array[1];
            BigInteger   g     = DHParametersHelper.SelectGenerator(p, q, this.random);

            return(new ElGamalParameters(p, g));
        }
        /**
         * which Generates the p and g values from the given parameters,
         * returning the ElGamalParameters object.
         * <p>
         * Note: can take a while...
         * </p>
         */
        public ElGamalParameters GenerateParameters()
        {
            //
            // find a safe prime p where p = 2*q + 1, where p and q are prime.
            //
            BigInteger[] safePrimes = DHParametersHelper.GenerateSafePrimes(size, certainty, random);

            BigInteger p = safePrimes[0];
            BigInteger q = safePrimes[1];
            BigInteger g = DHParametersHelper.SelectGenerator(p, q, random);

            return(new ElGamalParameters(p, g));
        }
Exemple #4
0
        /**
         * which Generates the p and g values from the given parameters,
         * returning the DHParameters object.
         * <p>
         * Note: can take a while...</p>
         */
        public virtual DHParameters GenerateParameters()
        {
            //
            // find a safe prime p where p = 2*q + 1, where p and q are prime.
            //
            IBigInteger[] safePrimes = DHParametersHelper.GenerateSafePrimes(size, certainty, random);

            IBigInteger p = safePrimes[0];
            IBigInteger q = safePrimes[1];
            IBigInteger g = DHParametersHelper.SelectGenerator(p, q, random);

            return(new DHParameters(p, g, q, BigInteger.Two, null));
        }