Пример #1
0
Файл: ASN1.cs Проект: sv99/DVSDK
        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
            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();
        }
Пример #2
0
Файл: ASN1.cs Проект: sv99/DVSDK
        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);
        }