There are not many common BER reading libraries, because it is IMPOSSIBLE to unambiguously analyze arbitrary BER data without at least some knowledge of the schema.
The tool that you point to CodeProject edits the ASN.1 schemes that are used to create BER encodings, but you CANNOT go in the other direction without knowing the data or guessing. It is impossible to tell by looking at the id and length of the BER element whether this element contains primitive data or other BER elements.
Here is the smallest example I gave to demonstrate the problem, with only 5 bytes, with two radically different interpretations:
0xA0 0x03 0x02 0x01 0x00
Now this is an explicitly constructed, context-sensitive type. It also has a certain length. But what's inside? You can not say!
It can be an integer (0x02 is a primitive tag for an integer, 0x01 is len, value 0x00).
But it can also be a bit string (you can put the bit string in the constructed type, and then 2 is the number of bits not used at the end, which means that we have 14 bits that go 0000 0001 0000 00xxb = 00 0000 0100 0000b = 0x0040.
You can write an editor that will read / modify / write BER files, but it must know the scheme, or it will not be able to read anything correctly.
Michael kohne
source share