It provides two tools,
der2ascii, to convert DER ASCII to a
byte string and vice versa. To install them, run:
go install github.com/google/der-ascii/cmd/...@latest
These tools may be used to create test inputs by taking an existing DER or BER
structure, disassembling it with
der2ascii into DER ASCII, making
adjustments, and assembling back into binary with
ascii2der. This avoids
having to manually fix up all the length prefixes. As a bonus, it acts as a
human-readable view for DER structures.
The DER ASCII language itself may be extended over time, but the intention is for extensions to be backwards-compatible. Specifically:
The command-line interface to
der2asciiwill remain compatible, though new options may be added in the future.
Previously valid inputs to
ascii2derwill remain valid and produce the same output. In particular, checking in test data as
ascii2derinputs should be future-proof, though it is recommended to check in the generated version as well in case of mistakes.
Previously invalid inputs to
ascii2dermay become valid in the future if the language is extended.
der2asciiis necessarily a heuristic, so its output may change over time. For example, later revisions may recognize new OIDs, tweak the formatting, or disassemble a malformed DER input in a (hopefully) more useful form.
This is not an official Google project.