public BigInteger ReadBigInteger()
{
var type = ReadByte();
if (type != Integer)
throw new InvalidOperationException("Invalid data type, INTEGER(02) is expected.");
var length = ReadLength();
var data = ReadBytes(length);
return new BigInteger(data.Reverse());
}
/// <summary> /// Initializes a new instance of the <see cref="Key"/> class. /// </summary> /// <param name="data">DER encoded private key data.</param> public Key(byte[] data) { if (data == null) throw new ArgumentNullException("data"); var der = new DerData(data); var version = der.ReadBigInteger(); var keys = new List<BigInteger>(); while (!der.IsEndOfData) { keys.Add(der.ReadBigInteger()); } this._privateKey = keys.ToArray(); }