I am finding a lot of contradicting information regarding the tag value for the SEQUENCE (OF) ASN.1 datatype:
Wikipedia claims it is both 0x10 and 0x30:
http://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One -> 0x30
http://en.wikipedia.org/wiki/Basic_Encoding_Rules -> 0x10
According to Microsoft it is 0x30:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb540799%28v=VS.85%29.aspx
And in the Bouncycastle sources one can find:
public const int Sequence = 0x10;
So it is basically a tie between 0x10 and 0x30. Do you know that the real value is or am I missing something?
In ASN. 1, an ordered list of elements (or components) comprises a SEQUENCE. Using SEQUENCE, you can create a new type built from an arbitrary series of elements. Each element must identify its type, either by specifying a type name or by actually defining the element's type inline.
Specifying Tags Note that ASN. 1 tags can be used to identify a type as well as a field (for example, if some components of a SEQUENCE type are optional, tags can be used to detect whether the optional components are absent or present).
ASN. 1, or Abstract Syntax Notation One, is an International Standards Organization (ISO) data representation format used to achieve interoperability between platforms.
Primitive types within ASN. 1 are those types that are not constructed or cannot be broken down into more primitive types. They correspond to the normal data types encountered in many programming and data definition languages.
A BER encoded "tag" is made up of several bit fields:
--------------------------------- | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | --------------------------------- |Class |P/C| Tag Number | ---------------------------------
Note that there's many ways to encode a sequence in BER/DER/CER, it depends on the exact ASN.1 used. e.g. some protocol might override the class and specify a sequence as Application Specific class, and/or it might specify its own Tag Number if Implicit tagging is used.
You can read the BER encoding spec here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With