IT lexicon › Programming › BER-TLV

BER-TLV

Programming På svenska → Updated: 2026-10-31

The tag-length-value encoding that almost everything on a chip card is written in, borrowed from ASN.1 and trimmed for cards with a few kilobytes of memory.

BER is Basic Encoding Rules from ITU X.690, and EMV picked it up by way of ISO/IEC 7816-4. Each data element has three parts: a tag saying what it is, a length and the value. Tag 5A is the card number, 9F02 the amount authorised and 9F26 the application cryptogram. If the five low bits of the first tag byte are all set, the tag continues into the next byte, and bit 6 marks a constructed value that itself holds more TLV objects, such as the 70 or 77 templates. Lengths above 127 bytes get an 81 or 82 prefix.

The format is compact and self-describing, which is why it has survived. It is also why every terminal developer eventually writes their own parser and forgets about two-byte tags.

← Back to the lexicon