public Asn1Sequence( Asn1Object asn1Obj, UInt32 depth ) : this(asn1Obj) { this.depth = depth; }
public static Asn1Object[] ParseAsn1Sequence(Stream asn1Stream, UInt32 length) { Asn1Object myObj; // Create new generic list class for holding Asn1Objects List<Asn1Object> myList = new List<Asn1Object>(); while (length > 0) { myObj = new Asn1Object(asn1Stream); // Stream position is incremented in object creation if (myObj.ContentID.TagNumber == Asn1TagNumber.SEQUENCE) { myList.Add(new Asn1Sequence(myObj)); } else { myList.Add(myObj); } length -= (myObj.ContentID.OctetFieldLength + myObj.ContentLength.OctetFieldLength + myObj.ContentLength.Length); } if (length != 0) throw new IOException("Amount of data parsed did not match amount available!"); return myList.ToArray(); }
public Asn1Sequence( Asn1Object asn1Obj ) { if (asn1Obj.ContentID.TagNumber != Asn1TagNumber.SEQUENCE) { throw new ArgumentException("Input Object is not an ASN.1 Sequence!"); } this.identification = asn1Obj.ContentID; this.length = asn1Obj.ContentLength; this.contents = asn1Obj.Contents; // Parse through the Sequence and generate array of Asn1Object's seqElements = ParseAsn1Sequence(contents,length.Length); }