throws Exception
{
DHParameterSpec elParams = new DHParameterSpec(p, g, privateValueSize);
int size = p.bitLength();
new BouncyCastleProvider().setParameter(ConfigurableProvider.DH_DEFAULT_PARAMS, elParams);
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("ElGamal", "BC");
byte[] in = "This is a test".getBytes();
keyGen.initialize(p.bitLength());
KeyPair keyPair = keyGen.generateKeyPair();
new BouncyCastleProvider().setParameter(ConfigurableProvider.DH_DEFAULT_PARAMS, elParams);
SecureRandom rand = new SecureRandom();
checkKeySize(privateValueSize, keyPair);