b2KIT

ASN.1 Decoder

Decode ASN.1/DER encoded data into a human-readable tree structure for certificate and key inspection.

Tested tool guide Tested browser tools Checked August 16, 2026

What ASN.1 Decoder does, with a checked example

Takes Base64 or hex input in DER form - the binary encoding behind X.509 certificates, RSA and EC keys, CSRs, and CMS messages - and parses its tag-length-value structure into an indented tree, resolving object identifiers such as 1.2.840.113549.1.1.1 to names like rsaEncryption. Decoding exposes structure, not meaning: a certificate's signature value appears as an opaque BIT STRING, and a pasted public key turns out to be two integers wrapped inside a BIT STRING rather than a certificate. The usual surprise is that DER is deterministic but not self-explanatory - identical structures mean different things depending on where they appear.

Worked example

A concrete input and expected output from the current implementation.

Input

MA0GCSqGSIb3DQEBAQUA

Expected output

SEQUENCE (len 13, 2 elements)
  - OBJECT IDENTIFIER 1.2.840.113549.1.1.1 (rsaEncryption)
  - NULL

That base64 decodes to the 15 DER bytes 30 0D 06 09 2A 86 48 86 F7 0D 01 01 01 05 00: a SEQUENCE holding the rsaEncryption OID (1.2.840.113549.1.1.1) and an empty NULL parameter. This exact blob is the AlgorithmIdentifier that prefixes every RSA public key in SubjectPublicKeyInfo form, which is why it recurs in PEM key files.

How the result is produced

1

Reading tag, length, and value

Every DER element is three parts: a tag byte naming the type (0x30 SEQUENCE, 0x02 INTEGER, 0x06 OBJECT IDENTIFIER, 0x03 BIT STRING, 0x04 OCTET STRING, 0x05 NULL), a length, and the value. Lengths under 128 bytes use a single byte; longer values switch to the long form with a byte count. Constructed types such as SEQUENCE are decoded recursively, so nesting in the data becomes depth in the tree.

2

Resolving identifiers and numbers

Object identifiers decode as big-endian base-128 components with the first two arcs folded into one byte: 1.2.840.113549.1.1.1 becomes 2A 86 48 86 F7 0D 01 01 01. Known OIDs map to names such as rsaEncryption; unknown ones stay dotted. INTEGERs are big-endian and signed, so values with the high bit set carry a leading zero byte. BIT STRINGs begin with an unused-bits count, and time fields use two-digit UTCTime or four-digit GeneralizedTime years.

Good uses

  • Check a freshly generated key, CSR, or certificate - confirm the algorithm OID, key size, and field order before a CA or server sees it.
  • Debug why a system rejects a DER blob: a missing NULL parameter, a malformed length, or stray trailing bytes are all visible in the tree.
  • Read a specific value out of a file without openssl - the serial number, validity dates, or the RSA modulus and exponent as displayed numbers.

Limits and checks

  • Structure, not trust. The tree shows fields but verifies nothing: a certificate that decodes cleanly can still be expired, self-signed, or signed by an unknown CA. Signature verification happens outside a decoder.
  • Same bytes, different meanings. A decoder cannot tell a certificate from a key from a CSR; the difference lives in the surrounding schema, not the encoding. Two structurally identical SEQUENCEs can mean different things in different positions.
  • PEM variants. 'BEGIN PUBLIC KEY' is SubjectPublicKeyInfo (OID plus BIT STRING), while 'BEGIN RSA PUBLIC KEY' is bare PKCS#1 with no OID, and the tree differs accordingly. Input in BER rather than canonical DER may also fail, since BER permits indefinite lengths that DER forbids.

Common questions

Why do some fields show only hex instead of readable text?

Because DER stores many values as opaque blobs by design: a certificate signature is a BIT STRING of raw bytes, and extensions like AuthorityKeyIdentifier are themselves DER nested inside an OCTET STRING. The outer encoding is exactly what hides the inner structure, so the tree shows the wrapper and its hex payload. That is the format's intent, not a decoder shortcoming.

Can I paste a PEM file with the BEGIN and END lines included?

Yes. PEM is just base64 armor around the same DER bytes: the BEGIN line, headers, base64 body, and END line are all stripped before decoding. What the tool will not do is name the document type - the same bytes could be a certificate, a CSR, or a key, and the tree reports structure while you supply the interpretation.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools