Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

dumpasn1 ASN.1 object dump / syntax check program

dumpasn1 is a diagnostic tool that dumps data encoded using ASN.1 encoding rules like BER and DER in a variety of user-specified formats. Sample output using the default format is:

 256  159: SEQUENCE {
 259   13:   SEQUENCE {
 261    9:     OBJECT IDENTIFIER rsaEncryption (1 2 840 113549 1 1 1)
 272    0:     NULL
         :     }
 274  141:   BIT STRING, encapsulates {
 278  137:     SEQUENCE {
 281  129:       INTEGER
         :         00 E5 19 BF 6D A3 56 61 2D 99 48 71 F6 67 DE B9
[...]    :         8F
 413    3:       INTEGER 65537
         :       }
         :     }
         :   }

Overview

dumpasn1 displays ASN.1 data in human-readable format, including digging into opaque encodings like bit and byte strings to display nested objects, as well as displaying known object identifiers in human-readable form. It will also warn about common encoding errors and other problems.

Lapo Luchini has created an online version in Javascript that allows interactive browsing of ASN.1 objects. For PGP users there's an [equivalent utility available called pgpdump](http:// pgp.iijlab.net/pgpdump.html).

Installation and Usage

dumpasn1 should build directly on most platforms:

cc -o dumpasn1 dumpasn1.c

To see the command-line options, run dumpasn1 without any arguments:

Usage: dumpasn1 [-acdefghilmopqrstuvwxz] <file>

  Input options:
       - = Take input from stdin (some display options will be disabled)
       -q = Disable warning about stdin use affecting display options
       -<number> = Start <number> bytes into the file
       -- = End of arg list
       -c<file> = Read Object Identifier info from alternate config file
            (values will override equivalents in global config file)

  Output options:
       -f<file> = Dump object at offset -<number> to file (allows data to be
            extracted from encapsulating objects)
       -w<number> = Set width of output, default = 80 columns

  Display options:
       -a = Print all data in long data blocks, not just the first 128 bytes
       -d = Print dots to show column alignment
       -g = Display ASN.1 structure outline only (no primitive objects)
       -h = Hex dump object header (tag+length) before the decoded output
       -hh = Same as -h but display more of the object as hex data
       -i = Use shallow indenting, for deeply-nested objects
       -l = Long format, display extra info about Object Identifiers
       -m<number>  = Maximum nesting level for which to display content
       -p = Pure ASN.1 output without encoding information
       -t = Display text values next to hex dump of data
       -v = Verbose mode, equivalent to -ahlt

  Format options:
       -e = Don't print encapsulated data inside OCTET/BIT STRINGs
       -r = Print bits in BIT STRING as encoded in reverse order
       -u = Don't format UTCTime/GeneralizedTime string data
       -x = Display size and offset in hex not decimal

  Checking options:
       -o = Don't check validity of character strings hidden in octet strings
       -s = Syntax check only, don't dump ASN.1 structures
       -z = Allow zero-length items

Warnings generated by deprecated OIDs require the use of '-l' to be displayed.
Program return code is the number of errors found or EXIT_SUCCESS.

Contributing

All contributions are welcome.

License

dumpasn1 is made available under the Creative Commons Attribution license.