AsymmetricCipherKeyPair pair = kpGen.generateKeyPair();
ElGamalPublicKeyParameters pu = (ElGamalPublicKeyParameters)pair.getPublic();
ElGamalPrivateKeyParameters pv = (ElGamalPrivateKeyParameters)pair.getPrivate();
ElGamalEngine e = new ElGamalEngine();
e.init(true, pu);
String message = "This is a test";
byte[] pText = message.getBytes();
byte[] cText = e.processBlock(pText, 0, pText.length);
e.init(false, pv);
pText = e.processBlock(cText, 0, cText.length);
if (!message.equals(new String(pText)))
{
return new SimpleTestResult(false, this.getName() + ": generation test failed");
}