TLV stands for Type-Length-Value, a data encoding format widely used in telecommunications, smart cards, and network protocols. It's a simple yet powerful way to structure binary data by dividing information into three parts: a type identifier, a length indicator, and the actual value.
TLV encoding is essential in many real-world applications including credit card chip transactions (EMV), network protocol messages, configuration files, and IoT device communication. Understanding TLV helps you analyze and debug these systems.
The Type field identifies what kind of data follows. It's typically 1-2 bytes and acts as an identifier. For example, in EMV payment cards, type 9F02 represents "Amount, Authorized".
The Length field specifies how many bytes of data are in the Value field. This can be simple (1 byte for lengths up to 255) or use multi-byte encoding for larger values. Knowing the length allows parsers to jump directly to the next TLV element.
The Value field contains the actual data. It can be any format: text, numbers, binary data, or even nested TLV structures. The Type field tells you how to interpret these bytes.
9F02 06 000000001000
9F02 = Amount, Authorized06 = 6 bytes000000001000 = $10.00The Parse TLV operation in CyberChef converts TLV-encoded data into a readable JSON format. This is extremely useful when analyzing network packets, smart card data, or any system using TLV encoding.
Understanding how TLV data is structured helps you work with it more effectively. This interactive visualizer breaks down TLV encoding step by step:
Different systems use different tag sets. Here are some common examples from EMV payment systems:
| Tag (Hex) | Description | Typical Length |
|---|---|---|
9F02 |
Amount, Authorized | 6 bytes |
9F03 |
Amount, Other | 6 bytes |
5F2A |
Transaction Currency Code | 2 bytes |
82 |
Application Interchange Profile | 2 bytes |
9F26 |
Application Cryptogram | 8 bytes |
9F37 |
Unpredictable Number | 4 bytes |
When working with TLV data in CyberChef, follow these guidelines for best results:
If parsing fails, ensure your input contains only valid hexadecimal characters (0-9, A-F). Remove spaces, colons, or other separators unless the parser explicitly supports them.
If the output looks wrong, the Length field might be corrupted or incorrectly encoded. This causes the parser to read the wrong number of bytes for the Value.
Incomplete TLV data will result in partial parsing. Ensure you have the complete message, including all bytes specified by each Length field.
Some TLV implementations use nested structures where a Value contains more TLV elements. You may need to parse these recursively or run Parse TLV again on specific value fields.
The Parse TLV operation in CyberChef is an essential tool for analyzing structured binary data. By converting TLV-encoded information into readable JSON format, it helps you understand complex data formats used in payment systems, network protocols, and smart cards. Remember to verify your input format, reference appropriate tag documentation, and validate the parsed output against expected values.