// Public Constructors
        public Asn1Tag(Stream dataStream) : base()
        {
            Byte b = ReadByte(dataStream);

            tagNumber = GetNumber(b);
            tagType   = GetType(b);
            tagClass  = GetClass(b);

            if (tagNumber == Asn1TagNumber.HIGHNUMBER)
            {
                UInt32 tagNo = 0;
                b = ReadByte(dataStream);
                if ((b & 0x7F) == 0x00)
                {
                    throw new IOException("Invalid tag number!");
                }
                else
                {
                    while ((b & 0x80) == 0x80)
                    {
                        // Get bits from intermdeiate octets
                        tagNo  |= (UInt32)(b & 0x7F);
                        tagNo <<= 7;
                        // Read next byte from dataStream
                        b = ReadByte(dataStream);
                    }

                    // Get bits from last octet
                    tagNo |= (UInt32)(b & 0x7F);
                }
                tagNumber = (Asn1TagNumber)tagNo;
            }
        }
Example #2
0
File: ASN1.cs Project: sv99/DVSDK
        // Public Constructors
        public Asn1Tag( Stream dataStream )
            : base()
        {
            Byte b = ReadByte(dataStream);
              tagNumber = GetNumber(b);
              tagType   = GetType(b);
              tagClass  = GetClass(b);

              if (tagNumber == Asn1TagNumber.HIGHNUMBER)
              {
            UInt32 tagNo = 0;
            b = ReadByte(dataStream);
            if ((b & 0x7F) == 0x00)
              throw new IOException("Invalid tag number!");
            else
            {
              while ((b & 0x80) == 0x80)
              {
            // Get bits from intermdeiate octets
            tagNo |= (UInt32)(b & 0x7F);
            tagNo <<= 7;
            // Read next byte from dataStream
            b = ReadByte(dataStream);
              }

              // Get bits from last octet
              tagNo |= (UInt32) (b & 0x7F);
            }
            tagNumber = (Asn1TagNumber) tagNo;
              }
        }