There has always been a need to present ASN.1 BER/CER/DER (Basic, Canonical, and Distinguished Encoding Rules) binary messages in human readable format to more easily examine their correctness and pinpoint the location of errors in problematic messages without requiring access to their schemas.
To satisfy this need, earlier versions of the OSS ASN.1/Java Tools included a native osstlv utility. While the utility is quite useful, there are limitations resulting from it being written in C. The utility can not be invoked programmatically from a Java application. Also, as a native utility, it was not always possible to use it on the same machine/platform where the problematic BER messages were detected. These limitations failed to meet the basic requirement of platform-independent Java applications: the ability to run on any platform.
Beginning with release 8.3 of the ASN.1/Java Tools, a new platform-independent osstlv utility is included in the Tools. It is written in Java and is available as a self-contained executable jar that can be run as a standalone application. The utility can also be invoked programmatically using the API (BERTool.dumpTLV()). This new utility supports a new ExtendedDump format, as well as the hexadecimal, decomposed, and syntax TLV formats already supported in the old native osstlv utility. The new API enables you to develop custom formats to suit your needs.
The new Extended Dump TLV format is similar to the hexadecimal memory dump. It includes three fields separated by colons: file offset, encoding in hexadecimal, and encoding in ASCII. The Tag-Length and Contents parts are printed on separate lines. The ASCII representation for the Tag-Length part contains the character 'C' for constructed encodings and 'P' for primitive, as well as formatted tag and length.
Examples:
Definite length encoding:
0000 : 30 2A : C [UNIVERSAL 16] 42
0002 : 30 06 : C [UNIVERSAL 16] 6
0004 : 02 01 : P [UNIVERSAL 2] 1
0006 : 0A : .
0007 : 01 01 : P [UNIVERSAL 1] 1
0009 : FF : .
0010 : 30 00 : C [UNIVERSAL 16] 0
0012 : 30 1E : C [UNIVERSAL 16] 30
0014 : 09 09 : P [UNIVERSAL 9] 9
0016 : 80 35 09 54 0A 2B E5 20 DF : .5.T.+. .
0025 : 17 11 : P [UNIVERSAL 23] 17
0027 : 39 32 30 34 32 33 31 37 34 33 33 34 : 920423174334
0039 : 2D 30 37 30 30 : -0700
Indefinite length encoding:
0000 : 30 80 : C [UNIVERSAL 16] indef
0002 : 30 80 : C [UNIVERSAL 16] indef
0004 : 02 01 : P [UNIVERSAL 2] 1
0006 : 0A : .
0007 : 01 01 : P [UNIVERSAL 1] 1
0009 : FF : .
0010 : 00 00 : END-OF-CONTENTS
0012 : 30 80 : C [UNIVERSAL 16] indef
0014 : 00 00 : END-OF-CONTENTS
0016 : 30 80 : C [UNIVERSAL 16] indef
0018 : 09 09 : P [UNIVERSAL 9] 9
0020 : 80 35 09 54 0A 2B E5 20 DF : .5.T.+. .
0029 : 17 11 : P [UNIVERSAL 23] 17
0031 : 39 32 30 34 32 33 31 37 34 33 33 34 : 920423174334
0043 : 2D 30 37 30 30 : -0700
0048 : 00 00 : END-OF-CONTENTS
0050 : 00 00 : END-OF-CONTENTS
Detailed information about the new ossltv utility class can be found in the ASN.1/Java Tools online documentation. Download a trial of the Tools and evaluate for yourself the usefulness of this utility.
No comments:
Post a Comment