Ambimat GroupAmbimatAmbiSecureSIMAuthAmbiAutomationEngineering BlogAhmedabad · India · Est. 1982
ASN.1 / X.680

ASN.1 Universal Tags

Universal-class tag identifiers from ITU-T X.680 — the encoding floor underneath every DER-encoded X.509 certificate, PKCS structure, CMS envelope, FIDO attestation x5c chain, and EMV PKI artefact you will ever parse.

BER · DER · CER — the encoding rules

BER (Basic Encoding Rules)

X.690 §8. The permissive parent. A single ASN.1 value may have multiple BER encodings — indefinite length, primitive or constructed, varying contents bytes. Use BER when you read, never when you write.

DER (Distinguished Encoding Rules)

X.690 §10. The canonical subset of BER. Every value has exactly one encoding: definite length, primitive when allowed, smallest representation. Used by X.509, PKCS, CMS, WebAuthn attestation. Always write DER.

CER (Canonical Encoding Rules)

X.690 §9. A second canonical subset, optimised for streaming over very long values via indefinite-length constructed encoding. Rare outside specific telecom contexts; the modern world is DER.

Tag classes

Universal (00)

Defined in X.680. The 16 universal-class tags below carry built-in types — INTEGER, OCTET STRING, SEQUENCE, etc.

Application (01)

Application-specific tags scoped to a particular protocol or PDU set. EMV uses these heavily.

Context-specific (10)

The most common non-universal class. Disambiguates fields inside a containing structure. [0], [1], [2] … tags inside X.509 extensions are context-specific.

Private (11)

Reserved for enterprise / vendor use. Rarely encountered in interoperable protocols.

The 16 universal tags

Filter below by form — Primitive (value carried directly in the contents octets) vs Constructed (value is a sequence of TLV children). The SEQUENCE and SET tags are always constructed; BIT STRING and OCTET STRING may be either, but DER mandates primitive when length fits.

Companion ASN.1 tooling

Walk a structure

ASN.1 Tree Explorer — collapsible tree walker for any DER blob.
ASN.1 Parser — flat TLV walker with OID lookup.

Where ASN.1 shows up

Further reading

Specifications

ITU-T X.680 (syntax) · X.690 (BER/DER/CER) · X.691 (PER) · X.693 (XER)

Frequently asked questions

What is ASN.1?

A notation for describing data structures independently of how they are encoded, with encoding rules such as BER and DER defining the bytes on the wire.

What is the difference between BER and DER?

BER permits several encodings of the same value; DER is the canonical subset allowing exactly one. Signatures are computed over DER because it is unambiguous.

What are the universal-class tags?

The base types: 01 BOOLEAN, 02 INTEGER, 03 BIT STRING, 04 OCTET STRING, 05 NULL, 06 OBJECT IDENTIFIER, 30 SEQUENCE, 31 SET, plus the string and time types.

What makes a tag constructed rather than primitive?

Bit 6 of the identifier octet. A constructed encoding contains further TLV elements, which is why SEQUENCE (0x30) nests and OCTET STRING (0x04) usually does not.

Why do certificate extensions use context-specific tags?

Because they are optional fields whose meaning comes from their position in the parent structure rather than from a universal type — which is what 0xA0-style tags express.