1 .\" Automatically generated by Pandoc 1.16.0.2
4 .TH "unber" "1" "2016\-01\-23" "ASN.1 BER Decoder" "Version 0.9.28"
5 .nh \" Turn off hyphenation by default.
8 unber \-\- the ASN.1 BER Decoder
11 unber [\f[B]\-1\f[]] [\f[B]\-i\f[]\f[I]indent\f[]] [\f[B]\-m\f[]]
12 [\f[B]\-p\f[]] [\f[B]\-s\f[]\f[I]skip\f[]]
13 [\f[B]\-t\f[]\f[I]hex\-string\f[]] [\f[B]\-\f[]]
14 [\f[I]input\-filenames\f[]...]
17 unber presents the internal structure of BER\-encoded files as a human
19 A single dash denotes the standard input.
21 (The DER and CER formats are subsets of the BER and are also supported.)
25 Do \f[I]not\f[] attempt to read the next BER structure after the first
27 This may be useful if the input contains garbage past the single BER
29 By default, unber continues decoding until the end of file (input
34 .B \-i \f[I]indent\f[]
35 Use the specified number of spaces for output indentation.
41 Generate shorter output while still preserving BER encoding information.
46 Do \f[I]not\f[] attempt to pretty\-print known ASN.1 types
47 (\f[C]BOOLEAN\f[], \f[C]INTEGER\f[], \f[C]OBJECT\ IDENTIFIER\f[], etc).
48 By default, some ASN.1 types are converted into the text representation.
51 This option is required if the \f[C]unber\f[](1) output is used as an
52 input to \f[C]enber\f[](1).
56 Ignore the first \f[I]skip\f[] bytes in the input stream; useful for
57 stripping off lower level protocol framing data.
61 .B \-t \f[I]hex\-string\f[]
62 Interpret the hex\-string as a sequence of hexadecimal values
63 representing the start of BER TLV encoding.
64 Print the human readable explanation.
69 unber dumps the output in the regular XML format which preserves most of
70 the information from the underlying binary encoding.
72 The XML opening tag format is as follows:
74 <\f[B]tform\f[] O="\f[B]off\f[]" T="\f[B]tag\f[]" TL="\f[B]t_len\f[]"
75 V="{Indefinite|\f[B]v_len\f[]}" [A="\f[B]type\f[]"] [\f[B]F\f[]]>
80 Encoding form the value is in: primitive ("P") or constructed ("C") or
81 constructed with indefinite length ("I")
86 Offset of the encoded element in the unber input stream.
91 The tag class and value in human readable form.
96 The length of the TL (BER Tag and Length) encoding.
101 The length of the value (V, encoded by the L), may be "Indefinite".
106 Likely name of the underlying ASN.1 type (for UNIVERSAL tags).
111 Indicates that the value was reformatted (pretty\-printed).
112 This will never appear in the output produced using the \f[B]\-p\f[]
116 .SS Example XML output:
118 <I O="0" T="[UNIVERSAL 16]" TL="2" V="Indefinite" A="SEQUENCE">
122 \ <P O="2" T="[UNIVERSAL 19]" TL="2" V="2" A="PrintableString">US</P>
126 \ \ <C O="6" T="[UNIVERSAL 16]" TL="2" V="6" A="SEQUENCE">
130 \ \ \ \ <P O="8" T="[UNIVERSAL 2]" TL="2" V="4" A="INTEGER"
135 \ \ </C O="14" T="[UNIVERSAL 16]" A="SEQUENCE" L="8">
139 </I O="14" T="[UNIVERSAL 0]" TL="2" L="16">
142 Decode the given Tag/Length sequence specified in hexadecimal form:
145 unber\ \f[B]\-t\f[] "\f[I]bf 20\f[]"
148 Decode the DER file using two\-spaces indentation:
151 unber\ \f[B]\-i\f[] \f[I]2\f[]\ \f[I]filename.der\f[]
154 Decode the binary stream taken from the standard input:
157 cat \f[I]filename.der\f[] | unber \f[B]\-\f[]
160 Decode the binary stream and encode it back into an identical stream
161 (see \f[C]enber\f[](1)):
164 cat \f[I]filename.der\f[] | unber \f[B]\-p\f[] \f[B]\-\f[] | enber
165 \f[B]\-\f[] > \f[I]filename.ber\f[]
169 The constructed XML output is not necessarily well\-formed.
171 When indefinite length encoding is being used, the BER sequence which is
172 not terminated with the end\-of\-content octets will cause the
173 terminating \f[B]</I>\f[] XML tag to disappear.
174 Thus, invalid BER framing directly causes invalid XML output.
176 The \f[C]enber\f[](1) utility understands such XML correctly.
179 \f[C]enber\f[](1), \f[C]asn1c\f[](1).
181 Lev Walkin <vlm@lionet.info>.