Ejemplo n.º 1
0
    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)));
    }
Ejemplo n.º 2
0
    public AsymmetricCipherKeyPair GenerateKeyPair()
    {
        DHKeyGeneratorHelper instance   = DHKeyGeneratorHelper.Instance;
        ElGamalParameters    parameters = param.Parameters;
        DHParameters         dhParams   = new DHParameters(parameters.P, parameters.G, null, 0, parameters.L);
        BigInteger           x          = instance.CalculatePrivate(dhParams, param.Random);
        BigInteger           y          = instance.CalculatePublic(dhParams, x);

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