MicroTools
Category: developer

TLV (Tag-Length-Value) Parser

Parse, decode, and inspect BER-TLV, EMV smart cards, Base64 strings, and EMVCo/QRIS merchant data structures.

TLV (Tag-Length-Value) Data Architecture & EMVCo Decoding

Deep-dive into BER-TLV, ISO/IEC 7816 smart card data elements, and QRIS EMV payment payloads.

TLV (Tag-Length-Value) is a hierarchical binary encoding scheme used extensively in telecommunications protocols, cryptographic smart cards (ISO/IEC 7816, EMVCo), ASN.1 / BER specifications, and Indonesian National Standard QRIS payment codes. The structural architecture divides data streams into three sequential components: the Tag (identifying the semantic meaning of the field), the Length (defining the byte length of the value), and the Value (the raw payload data).

How It Works & Underlying Architecture

Our parser accepts Hexadecimal, Base64, or ASCII TLV strings. It inspects tag classes (Universal, Application, Context-Specific, Private) and constructs a nested tree when constructed tags (bit 6 = 1 in BER-TLV) contain child data elements. For Indonesian QRIS and EMVCo merchant QR codes, the tool parses mandatory root tags including Tag 00 (Payload Format Indicator), Tag 26-51 (Merchant Account Information), Tag 53 (Transaction Currency 360 for IDR), Tag 54 (Transaction Amount), and Tag 63 (CRC-16 CCITT checksum).

Technical Specifications & Standards

Protocols BER-TLV, ISO/IEC 7816, EMVCo 2.0, ASPI QRIS 1.3
Input Formats Hex string, Base64 payload, ASCII/Raw string
Checksum Support CRC-16 / CCITT-FALSE (Polynomial 0x1021)
Tree Depth Unlimited recursive nested parsing

Real-World Engineering & Creative Use Cases

  • Fintech & Payment Gateway Testing: Verifying QRIS dynamic payload generation, Tag 54 amounts, and merchant IDs.
  • EMV Smart Card Development: Inspecting APDU response structures from chip-and-pin bank cards.
  • Telecommunications: Decoding GSM SIM card Elementary Files (EF) and ASN.1 mobile signaling records.

Frequently Asked Questions (FAQ)

What is the difference between BER-TLV and simple TLV?

Basic TLV uses fixed tag and length sizes (often 2 characters each). BER-TLV supports multi-byte tags (where bits indicate class and constructed status) and variable multi-byte lengths according to ASN.1 encoding rules.

How is Tag 63 (CRC Checksum) verified in QRIS codes?

The QRIS specification calculates a 16-bit CRC using the polynomial 0x1021 (initial value 0xFFFF) across all characters preceding the 4-character checksum itself.

Tags: #tlv#ber-tlv#emv#smartcard#base64#qris#decoder#hex tlv#asn1