BraintreeEncryption.Library.BouncyCastle.Crypto.Engines.RsaCoreEngine.Init C# (CSharp) Method

Init() public method

public Init ( bool forEncryption, ICipherParameters parameters ) : void
forEncryption bool
parameters ICipherParameters
return void
        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;
        }

Usage Example

コード例 #1
0
        /**
         * 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 (core == null)
            {
                core = new RsaCoreEngine();
            }

            core.Init(forEncryption, parameters);
        }