Skip to content
Free lab

ASN.1 / DER Decoder Lab

Every TLS certificate is a tree of Tag-Length-Value triplets encoded in DER. This lab ships a real, tiny parser that walks that tree in your browser — paste a certificate as hex or base64, or load a sample — then drills the three skills that matter: identifying which bytes are the serial number, validity, public key or extensions, decoding an OID or a time by hand, and spotting the malformed length encodings (indefinite, non-minimal, over-long) that DER forbids and that real certificate-parsing attacks rely on. Nothing you paste leaves the page.

The real job. More noise, a tighter clock.

0sPro

DER decoder — paste hex / base64 / PEM, or load a sample

Load a sample or paste bytes to walk the TLV tree.

Graded challenge

10 questions across three skills: identify a highlighted node in a decoded certificate, decode a raw INTEGER / OID / time, and spot a DER encoding that is malformed (indefinite or non-minimal length, over-long bounds). One point each; clear 70% to pass, under par for a speed bonus.

TLV cheat-sheet

  • 0x30 SEQUENCE · 0x31 SET
  • 0x02 INTEGER · 0x01 BOOLEAN
  • 0x06 OBJECT IDENTIFIER
  • 0x03 BIT STRING · 0x04 OCTET STRING
  • 0x0c UTF8String · 0x13 PrintableString
  • 0x17 UTCTime · 0x18 GeneralizedTime
  • 0xa0.. context tag [n]

Each node is Tag · Length · Value. Length < 0x80 is short form; the high bit means long form. 0x80 (indefinite) is BER only and never valid DER.

Live arena

4 active
adversary kill-chain1/4
appsec-mara13%
pki-eng-sam10%
ca-admin-lee6%
asn1-analyst-you (you)0%

adversary staging…

TL;DR

What this lab is

  • A free, browser-based ASN.1 / DER lab: a real tiny parser walks the Tag-Length-Value tree of X.509 DER you paste (hex or base64/PEM) or a bundled sample — nothing leaves your browser.
  • DER is the byte encoding behind every TLS certificate: structures are SEQUENCE (0x30) and SET (0x31), leaves are INTEGER, OBJECT IDENTIFIER, strings, times, BIT STRING and OCTET STRING.
  • Graded challenge in three skills: identify a highlighted node (which cert field, what an OID means), decode a raw INTEGER / OID / time by hand, and spot a malformed encoding.
  • The lesson that matters for security: DER forbids indefinite-length (0x80) and non-minimal length encodings — a lax BER parser that accepts them is where crafted-certificate attacks live.
  • Difficulty tiers add deeper nesting, trickier OIDs and more malformed cases; you are scored on correct identifications, with a speed bonus and an S–D grade.

Frequently asked questions

What is the ASN.1 / DER Decoder Lab?

A free, in-browser exercise that teaches how X.509 certificates are encoded. ASN.1 is the schema language; DER (Distinguished Encoding Rules) is the exact byte encoding. A small parser in your browser walks the Tag-Length-Value tree and renders it, and a graded challenge asks you to identify certificate fields, decode raw values (INTEGER, OBJECT IDENTIFIER, UTCTime), and catch malformed encodings. No account, no install, and the bytes never leave your browser.

What is TLV and why does it matter?

Every DER element is a triplet: a Tag byte (what type — SEQUENCE 0x30, INTEGER 0x02, OBJECT IDENTIFIER 0x06, and so on), a Length, and the Value. Constructed types like SEQUENCE and SET hold more TLV triplets, so a certificate is a tree of them. Reading the tree is how you know which bytes are the serial number, the validity dates, the public key and the extensions.

Why does DER forbid indefinite and non-minimal lengths?

DER requires exactly one canonical encoding for any value: every length must be definite (no 0x80 indefinite form) and minimal (no long form where the short form fits, no leading zero octets). Signatures are computed over these exact bytes, so a parser that quietly accepts the looser BER variants can be fooled by two different byte strings that "mean" the same thing — a classic source of certificate-parsing vulnerabilities. The lab makes you spot those cases.

Is this a real parser?

Yes — the lab ships a small, pure-TypeScript DER parser that walks TLV triplets with full bounds checking and never throws (it returns an error instead). It is intentionally compact and teaching-focused, not a full production ASN.1 library, and it decodes the structures and OIDs you meet in an X.509 certificate.

🎉 New here? Use code WELCOME10 for 10% off any plan at checkout
ASN.1 / DER Decoder Lab — Free X.509 Byte-Level Trainer · PlayCISO