Example #1
0
        public virtual AsymmetricCipherKeyPair GenerateKeyPair()
        {
            DHKeyGeneratorHelper instance = DHKeyGeneratorHelper.Instance;
            DHParameters         dhParams = this.param.Parameters;
            BigInteger           x        = instance.CalculatePrivate(dhParams, this.param.Random);

            return(new AsymmetricCipherKeyPair(new DHPublicKeyParameters(instance.CalculatePublic(dhParams, x), dhParams), new DHPrivateKeyParameters(x, dhParams)));
        }
        public virtual AsymmetricCipherKeyPair GenerateKeyPair()
        {
            DHKeyGeneratorHelper instance   = DHKeyGeneratorHelper.Instance;
            DHParameters         parameters = param.Parameters;
            BigInteger           x          = instance.CalculatePrivate(parameters, param.Random);
            BigInteger           y          = instance.CalculatePublic(parameters, x);

            return(new AsymmetricCipherKeyPair(new DHPublicKeyParameters(y, parameters), new DHPrivateKeyParameters(x, parameters)));
        }
        public AsymmetricCipherKeyPair GenerateKeyPair()
        {
            DHKeyGeneratorHelper instance   = DHKeyGeneratorHelper.Instance;
            ElGamalParameters    parameters = this.param.Parameters;
            DHParameters         dhParams   = new DHParameters(parameters.P, parameters.G, null, 0, parameters.L);
            BigInteger           x          = instance.CalculatePrivate(dhParams, this.param.Random);

            return(new AsymmetricCipherKeyPair(new ElGamalPublicKeyParameters(instance.CalculatePublic(dhParams, x), parameters), new ElGamalPrivateKeyParameters(x, parameters)));
        }
        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)));
        }