CalculatePublic() приватный Метод

private CalculatePublic ( DHParameters dhParams, BigInteger x ) : BigInteger
dhParams Org.BouncyCastle.Crypto.Parameters.DHParameters
x Org.BouncyCastle.Math.BigInteger
Результат Org.BouncyCastle.Math.BigInteger
Пример #1
0
        public virtual AsymmetricCipherKeyPair GenerateKeyPair()
        {
            DHKeyGeneratorHelper helper = DHKeyGeneratorHelper.Instance;
            DHParameters         dhp    = param.Parameters;

            BigInteger x = helper.CalculatePrivate(dhp, param.Random);
            BigInteger y = helper.CalculatePublic(dhp, x);

            return(new AsymmetricCipherKeyPair(
                       new DHPublicKeyParameters(y, dhp),
                       new DHPrivateKeyParameters(x, dhp)));
        }
        public AsymmetricCipherKeyPair GenerateKeyPair()
        {
            DHKeyGeneratorHelper helper = DHKeyGeneratorHelper.Instance;
            ElGamalParameters    egp    = param.Parameters;
            DHParameters         dhp    = new DHParameters(egp.P, egp.G, null, 0, egp.L);

            BigInteger x = helper.CalculatePrivate(dhp, param.Random);
            BigInteger y = helper.CalculatePublic(dhp, x);

            return(new AsymmetricCipherKeyPair(
                       new ElGamalPublicKeyParameters(y, egp),
                       new ElGamalPrivateKeyParameters(x, egp)));
        }
        public AsymmetricCipherKeyPair GenerateKeyPair()
        {
            DHKeyGeneratorHelper helper   = DHKeyGeneratorHelper.Instance;
            ElGamalParameters    elParams = param.Parameters;

            BigInteger p = elParams.P;
            BigInteger x = helper.CalculatePrivate(p, param.Random, elParams.L);
            BigInteger y = helper.CalculatePublic(p, elParams.G, x);

            return(new AsymmetricCipherKeyPair(
                       new ElGamalPublicKeyParameters(y, elParams),
                       new ElGamalPrivateKeyParameters(x, elParams)));
        }