if (key instanceof ElGamalPrivateKey)
{
ElGamalPrivateKey k = (ElGamalPrivateKey)key;
return new ElGamalPrivateKeyParameters(k.getX(),
new ElGamalParameters(k.getParams().getP(), k.getParams().getG()));
}
throw new InvalidKeyException("can't identify ElGamal private key.");