boolean forEncryption,
CipherParameters param)
{
if (param instanceof ParametersWithRandom)
{
ParametersWithRandom p = (ParametersWithRandom)param;
this.key = (ElGamalKeyParameters)p.getParameters();
this.random = p.getRandom();
}
else
{
this.key = (ElGamalKeyParameters)param;
this.random = new SecureRandom();
}
this.forEncryption = forEncryption;
BigInteger p = key.getParameters().getP();
bitSize = p.bitLength();
if (forEncryption)
{
if (!(key instanceof ElGamalPublicKeyParameters))
{