I need a C/C++ code for decoding/dumping BER encoded files in human readable/parsable form.
## Deliverables
I need to be able to compile this code as a library.
The library should provide functions for dumping all the file contents at once, as well as fetching tag by tag.
I DON'T need full asn1 decoder. I just need readable representation of the binary (BER) file contents. Ideally tags would be fetched as char* and they'd be formatted like "xx yyy|zzz|vv"
(where xx is 00, 01, 10, or 11 regarding which tag class this is, yyy is tag id, for example APPLICATION 100 would look like "01 100"
zzz is tag value if the tag has value,
and vv is the tag level, so I know if it's a child tag, or brother/sister, or parent etc.)
Code must run as fast as possible.
It must be able to read files encoded like this (I don't know a name for it).
"Suppose you have a buffer of 8192 bytes. You start to place record into that buffer one by one. Once the next record does not fit into the buffer, you "flush" the buffer out and then start with a fresh buffer, anticipating that the next message will fit into the fresh buffer. So what happens on disk is this file where you get about 8k of data, then the "padding" of 0x00 or 0xff bytes until the nearest byte position divisible by 8192, then the next buffer worth of data, and so on. In other words, several records, then padding, then several records again, then padding again, and so on"
I will provide some test files.