Skip to main content

Posts

Showing posts with the label tlv

The QCAT Standard: Generating the QR Code

In this guide, we’ll explore how to generate the QCAT QR code by creating a custom TLV (Tag-Length-Value) structure in Kotlin. TLV encoding is commonly used in QR codes, smart cards, and other systems where data must be serialized into a compact, structured format. We'll also discuss encoding techniques, including converting date-times, durations, and ASCII values into hex format. Overview of the Code This Kotlin code focuses on generating a TLV structure that encodes various data fields such as a ticket ID, creator ID, creation timestamp, and a validity period into a hex-based format. Finally, it converts the TLV structure into a Base64 encoded string for easy transmission. The structure involves the following major steps: Hex Conversion: Converting data types like date-time, durations, and ASCII strings to hexadecimal. TLV Encoding: Wrapping each piece of data with a tag, its length, and value. Serialization: Serializing the data and converting it to a byte array for encoding....