public DerInteger( BigInteger value) { if (value == null) throw new ArgumentNullException("value"); bytes = value.ToByteArray(); }
internal static Array BigIntegerToBytes(NBitcoin.BouncyCastle.Math.BigInteger b, int numBytes) { if (b == null) { return(null); } byte[] bytes = new byte[numBytes]; byte[] biBytes = b.ToByteArray(); int start = (biBytes.Length == numBytes + 1) ? 1 : 0; int length = Math.Min(biBytes.Length, numBytes); Array.Copy(biBytes, start, bytes, numBytes - length, length); return(bytes); }
private byte[] int2octets(BigInteger v) { byte[] @out = v.ToByteArray(); if(@out.Length < rolen) { byte[] out2 = new byte[rolen]; Array.Copy(@out, 0, out2, rolen - @out.Length, @out.Length); return out2; } else if(@out.Length > rolen) { byte[] out2 = new byte[rolen]; Array.Copy(@out, @out.Length - rolen, out2, 0, rolen); return out2; } else { return @out; } }
public DerEnumerated( BigInteger val) { bytes = val.ToByteArray(); }