/** * initialise the RSA engine. * * @param forEncryption true if we are encrypting, false otherwise. * @param param the necessary RSA key parameters. */ public void Init( bool forEncryption, ICipherParameters parameters) { if (parameters is ParametersWithRandom) { parameters = ((ParametersWithRandom) parameters).Parameters; } if (!(parameters is RsaKeyParameters)) throw new InvalidKeyException("Not an RSA key"); this.key = (RsaKeyParameters) parameters; this.forEncryption = forEncryption; this.bitSize = key.Modulus.BitLength; }