use of org.gudy.bouncycastle.crypto.AsymmetricCipherKeyPair in project BiglyBT by BiglySoftware.
the class ElGamalKeyPairGenerator method generateKeyPair.
@Override
public AsymmetricCipherKeyPair generateKeyPair() {
BigInteger p, g, x, y;
int qLength = param.getStrength() - 1;
ElGamalParameters elParams = param.getParameters();
p = elParams.getP();
g = elParams.getG();
//
// calculate the private key
//
x = new BigInteger(qLength, param.getRandom());
//
// calculate the public key.
//
y = g.modPow(x, p);
return new AsymmetricCipherKeyPair(new ElGamalPublicKeyParameters(y, elParams), new ElGamalPrivateKeyParameters(x, elParams));
}
Aggregations