internal static Asn1Object CreatePrimitiveDerObject( int tagNo, DefiniteLengthInputStream defIn, byte[][] tmpBuffers) { switch (tagNo) { case Asn1Tags.Boolean: throw new IOException("invalid ECDSA sig"); case Asn1Tags.Enumerated: throw new IOException("invalid ECDSA sig"); case Asn1Tags.ObjectIdentifier: throw new IOException("invalid ECDSA sig"); } byte[] bytes = defIn.ToArray(); switch (tagNo) { case Asn1Tags.Integer: return(new DerInteger(bytes)); default: throw new IOException("unknown tag " + tagNo + " encountered"); } }
internal static byte[] GetBuffer(DefiniteLengthInputStream defIn, byte[][] tmpBuffers) { int len = defIn.GetRemaining(); if (len >= tmpBuffers.Length) { return(defIn.ToArray()); } byte[] buf = tmpBuffers[len]; if (buf == null) { buf = tmpBuffers[len] = new byte[len]; } defIn.ReadAllIntoByteArray(buf); return(buf); }