| .\" Automatically generated by Pandoc 1.16.0.2 |
| .\" |
| .ad l |
| .TH "unber" "1" "2016\-01\-23" "ASN.1 BER Decoder" "Version 0.9.28" |
| .nh \" Turn off hyphenation by default. |
| .SH NAME |
| .PP |
| unber \-\- the ASN.1 BER Decoder |
| .SH SYNOPSIS |
| .PP |
| unber [\f[B]\-1\f[]] [\f[B]\-i\f[]\f[I]indent\f[]] [\f[B]\-m\f[]] |
| [\f[B]\-p\f[]] [\f[B]\-s\f[]\f[I]skip\f[]] |
| [\f[B]\-t\f[]\f[I]hex\-string\f[]] [\f[B]\-\f[]] |
| [\f[I]input\-filenames\f[]...] |
| .SH DESCRIPTION |
| .PP |
| unber presents the internal structure of BER\-encoded files as a human |
| readable text. |
| A single dash denotes the standard input. |
| .PP |
| (The DER and CER formats are subsets of the BER and are also supported.) |
| .SH OPTIONS |
| .TP |
| .B \-1 |
| Do \f[I]not\f[] attempt to read the next BER structure after the first |
| one. |
| This may be useful if the input contains garbage past the single BER |
| sequence. |
| By default, unber continues decoding until the end of file (input |
| stream). |
| .RS |
| .RE |
| .TP |
| .B \-i \f[I]indent\f[] |
| Use the specified number of spaces for output indentation. |
| Default is 4 spaces. |
| .RS |
| .RE |
| .TP |
| .B \-m |
| Generate shorter output while still preserving BER encoding information. |
| .RS |
| .RE |
| .TP |
| .B \-p |
| Do \f[I]not\f[] attempt to pretty\-print known ASN.1 types |
| (\f[C]BOOLEAN\f[], \f[C]INTEGER\f[], \f[C]OBJECT\ IDENTIFIER\f[], etc). |
| By default, some ASN.1 types are converted into the text representation. |
| .RS |
| .PP |
| This option is required if the \f[C]unber\f[](1) output is used as an |
| input to \f[C]enber\f[](1). |
| .RE |
| .TP |
| .B \-s \f[I]skip\f[] |
| Ignore the first \f[I]skip\f[] bytes in the input stream; useful for |
| stripping off lower level protocol framing data. |
| .RS |
| .RE |
| .TP |
| .B \-t \f[I]hex\-string\f[] |
| Interpret the hex\-string as a sequence of hexadecimal values |
| representing the start of BER TLV encoding. |
| Print the human readable explanation. |
| .RS |
| .RE |
| .SH XML FORMAT |
| .PP |
| unber dumps the output in the regular XML format which preserves most of |
| the information from the underlying binary encoding. |
| .PP |
| The XML opening tag format is as follows: |
| .PP |
| <\f[B]tform\f[] O="\f[B]off\f[]" T="\f[B]tag\f[]" TL="\f[B]t_len\f[]" |
| V="{Indefinite|\f[B]v_len\f[]}" [A="\f[B]type\f[]"] [\f[B]F\f[]]> |
| .PP |
| Where: |
| .TP |
| .B \f[B]tform\f[] |
| Encoding form the value is in: primitive ("P") or constructed ("C") or |
| constructed with indefinite length ("I") |
| .RS |
| .RE |
| .TP |
| .B \f[B]off\f[] |
| Offset of the encoded element in the unber input stream. |
| .RS |
| .RE |
| .TP |
| .B \f[B]tag\f[] |
| The tag class and value in human readable form. |
| .RS |
| .RE |
| .TP |
| .B \f[B]t_len\f[] |
| The length of the TL (BER Tag and Length) encoding. |
| .RS |
| .RE |
| .TP |
| .B \f[B]v_len\f[] |
| The length of the value (V, encoded by the L), may be "Indefinite". |
| .RS |
| .RE |
| .TP |
| .B \f[B]type\f[] |
| Likely name of the underlying ASN.1 type (for UNIVERSAL tags). |
| .RS |
| .RE |
| .TP |
| .B [\f[B]F\f[]] |
| Indicates that the value was reformatted (pretty\-printed). |
| This will never appear in the output produced using the \f[B]\-p\f[] |
| command line option. |
| .RS |
| .RE |
| .SS Example XML output: |
| .PP |
| <I O="0" T="[UNIVERSAL 16]" TL="2" V="Indefinite" A="SEQUENCE"> |
| .PD 0 |
| .P |
| .PD |
| \ <P O="2" T="[UNIVERSAL 19]" TL="2" V="2" A="PrintableString">US</P> |
| .PD 0 |
| .P |
| .PD |
| \ \ <C O="6" T="[UNIVERSAL 16]" TL="2" V="6" A="SEQUENCE"> |
| .PD 0 |
| .P |
| .PD |
| \ \ \ \ <P O="8" T="[UNIVERSAL 2]" TL="2" V="4" A="INTEGER" |
| F>832970823</P> |
| .PD 0 |
| .P |
| .PD |
| \ \ </C O="14" T="[UNIVERSAL 16]" A="SEQUENCE" L="8"> |
| .PD 0 |
| .P |
| .PD |
| </I O="14" T="[UNIVERSAL 0]" TL="2" L="16"> |
| .SH EXAMPLES |
| .PP |
| Decode the given Tag/Length sequence specified in hexadecimal form: |
| .RS |
| .PP |
| unber\ \f[B]\-t\f[] "\f[I]bf 20\f[]" |
| .RE |
| .PP |
| Decode the DER file using two\-spaces indentation: |
| .RS |
| .PP |
| unber\ \f[B]\-i\f[] \f[I]2\f[]\ \f[I]filename.der\f[] |
| .RE |
| .PP |
| Decode the binary stream taken from the standard input: |
| .RS |
| .PP |
| cat \f[I]filename.der\f[] | unber \f[B]\-\f[] |
| .RE |
| .PP |
| Decode the binary stream and encode it back into an identical stream |
| (see \f[C]enber\f[](1)): |
| .RS |
| .PP |
| cat \f[I]filename.der\f[] | unber \f[B]\-p\f[] \f[B]\-\f[] | enber |
| \f[B]\-\f[] > \f[I]filename.ber\f[] |
| .RE |
| .SH FOOTNOTES |
| .PP |
| The constructed XML output is not necessarily well\-formed. |
| .PP |
| When indefinite length encoding is being used, the BER sequence which is |
| not terminated with the end\-of\-content octets will cause the |
| terminating \f[B]</I>\f[] XML tag to disappear. |
| Thus, invalid BER framing directly causes invalid XML output. |
| .PP |
| The \f[C]enber\f[](1) utility understands such XML correctly. |
| .SH SEE ALSO |
| .PP |
| \f[C]enber\f[](1), \f[C]asn1c\f[](1). |
| .SH AUTHORS |
| Lev Walkin <vlm@lionet.info>. |