according to for example http://luca.ntop.org/Teaching/Appunti/asn1.html a sequence has the tag number 10 in hexadecimal. But why it is then DER encoded as 30 and not 10? An INTEGER with the tag number 02 in hexadecimal is also encoded as 02. Thanks.
e.g.
Sample ::= SEQUENCE {
number 5
}
encoded as 30 03 02 01 05
ASN. 1 is the acronym for Abstract Syntax Notation One, a language for describing structured information; typically, information intended to be conveyed across some interface or communication medium. ASN. 1 has been standardised internationally. It is widely used in the specification of communication protocols.
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.
It is broadly used in telecommunications and computer networking, and especially in cryptography. Protocol developers define data structures in ASN.
This is because in X.509 formats, SET
and SEQUENCE
types are used in constructed form. As the result, 6th bit is set to 1. By setting 1 in 6th bit for SEQUENCE
universal tag (0x10) you will get 0x30 and 0x31 for SET
(0x11 and 6th bit to 1 = 0x31). The rest universal types are encoded in primitive forms (6th bit is set to 0).
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