BraintreeEncryption.Library.BouncyCastle.Crypto.Engines.RsaCoreEngine.ConvertInput C# (CSharp) Метод

ConvertInput() публичный Метод

public ConvertInput ( byte inBuf, int inOff, int inLen ) : BigInteger
inBuf byte
inOff int
inLen int
Результат BraintreeEncryption.Library.BouncyCastle.Math.BigInteger
        public BigInteger ConvertInput(
			byte[]	inBuf,
			int		inOff,
			int		inLen)
        {
            int maxLength = (bitSize + 7) / 8;

            if (inLen > maxLength)
                throw new DataLengthException("input too large for RSA cipher.");

            BigInteger input = new BigInteger(1, inBuf, inOff, inLen);

            if (input.CompareTo(key.Modulus) >= 0)
                throw new DataLengthException("input too large for RSA cipher.");

            return input;
        }

Usage Example

        /**
         * Process a single block using the basic RSA algorithm.
         *
         * @param inBuf the input array.
         * @param inOff the offset into the input buffer where the data starts.
         * @param inLen the length of the data to be processed.
         * @return the result of the RSA process.
         * @exception DataLengthException the input block is too large.
         */
        public byte[] ProcessBlock(
            byte[]      inBuf,
            int inOff,
            int inLen)
        {
            if (core == null)
            {
                throw new InvalidOperationException("RSA engine not initialised");
            }

            return(core.ConvertOutput(core.ProcessBlock(core.ConvertInput(inBuf, inOff, inLen))));
        }