public void init(boolean forEncrypting,
CipherParameters param)
{
this.forEncrypting = forEncrypting;
AsymmetricKeyParameter k;
if (param instanceof ParametersWithRandom)
{
k = (AsymmetricKeyParameter)((ParametersWithRandom)param).getParameters();
}
else
{
k = (AsymmetricKeyParameter)param;
}
if (forEncrypting && k.isPrivate())
{
throw new IllegalArgumentException("Encrypting Requires Public Key.");
}
if (!forEncrypting && !k.isPrivate())
{
throw new IllegalArgumentException("Decrypting Requires Private Key.");
}
reset();