3 ms·
TLV encoding. It can be a pain to implement correctly.
by bitexploder 3y ago
TLV encoding. It can be a pain to implement correctly.
- gmac 3y agoSince I didn't know the acronym: https://en.wikipedia.org/wiki/Type%E2%80%93length%E2%80%93value https://en.wikipedia.org/wiki/Type%E2%80%93length%E2%80%93va... In fact, a key part of the subtls library is a simple class to make this relatively painless (it's currently just called `Bytes`, but perhaps something like `TLVCoder` would be a more informative). It reserves space for the length field, and provides a callback to write it automatically once you're done writing the value: https://github.com/jawj/subtls/tree/main#navigating-the-code https://github.com/jawj/subtls/tree/main#navigating-the-code. It also enables the indented and annotated output options.