BitSharper.Utils.DecodeMpi C# (CSharp) Method

DecodeMpi() private static method

MPI encoded numbers are produced by the OpenSSL BN_bn2mpi function. They consist of a 4 byte big endian length field, followed by the stated number of bytes representing the number in big endian format.
private static DecodeMpi ( byte mpi ) : BigInteger
mpi byte
return Org.BouncyCastle.Math.BigInteger
        private static BigInteger DecodeMpi(byte[] mpi)
        {
            var length = ReadUint32Be(mpi, 0);
            var buf = new byte[length];
            Array.Copy(mpi, 4, buf, 0, (int) length);
            return new BigInteger(1, buf);
        }