if (mSecureRandom == null) {
mStrength = 1024;
mSecureRandom = new SecureRandom();
}
BigInteger p = new BigInteger(mStrength, 16, mSecureRandom);
BigInteger g = new BigInteger(mStrength - 1, mSecureRandom);
BigInteger x = new BigInteger(mStrength - 1, mSecureRandom);
BigInteger y = g.modPow(x, p);
ElGamalPublicKey publicKey = new ElGamalPublicKey(y, g, p);
ElGamalPrivateKey privateKey = new ElGamalPrivateKey(x, g, p);
return new KeyPair(publicKey, privateKey);