blob: 8f787b40ba6b1e7f27b4e4f6363c0766bc822b9c [file] [log] [blame]
Lev Walkinc6080fd2016-01-23 06:35:34 -08001.\" Automatically generated by Pandoc 1.16.0.2
2.\"
3.ad l
4.TH "unber" "1" "2016\-01\-23" "ASN.1 BER Decoder" "Version 0.9.28"
5.nh \" Turn off hyphenation by default.
6.SH NAME
7.PP
8unber \-\- the ASN.1 BER Decoder
9.SH SYNOPSIS
10.PP
11unber [\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[]...]
15.SH DESCRIPTION
16.PP
17unber presents the internal structure of BER\-encoded files as a human
18readable text.
19A single dash denotes the standard input.
20.PP
21(The DER and CER formats are subsets of the BER and are also supported.)
22.SH OPTIONS
23.TP
24.B \-1
25Do \f[I]not\f[] attempt to read the next BER structure after the first
26one.
27This may be useful if the input contains garbage past the single BER
28sequence.
29By default, unber continues decoding until the end of file (input
30stream).
31.RS
32.RE
33.TP
34.B \-i \f[I]indent\f[]
35Use the specified number of spaces for output indentation.
36Default is 4 spaces.
37.RS
38.RE
39.TP
40.B \-m
41Generate shorter output while still preserving BER encoding information.
42.RS
43.RE
44.TP
45.B \-p
46Do \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).
48By default, some ASN.1 types are converted into the text representation.
49.RS
50.PP
51This option is required if the \f[C]unber\f[](1) output is used as an
52input to \f[C]enber\f[](1).
53.RE
54.TP
55.B \-s \f[I]skip\f[]
56Ignore the first \f[I]skip\f[] bytes in the input stream; useful for
57stripping off lower level protocol framing data.
58.RS
59.RE
60.TP
61.B \-t \f[I]hex\-string\f[]
62Interpret the hex\-string as a sequence of hexadecimal values
63representing the start of BER TLV encoding.
64Print the human readable explanation.
65.RS
66.RE
67.SH XML FORMAT
68.PP
69unber dumps the output in the regular XML format which preserves most of
70the information from the underlying binary encoding.
71.PP
72The XML opening tag format is as follows:
73.PP
74<\f[B]tform\f[] O="\f[B]off\f[]" T="\f[B]tag\f[]" TL="\f[B]t_len\f[]"
75V="{Indefinite|\f[B]v_len\f[]}" [A="\f[B]type\f[]"] [\f[B]F\f[]]>
76.PP
77Where:
78.TP
79.B \f[B]tform\f[]
80Encoding form the value is in: primitive ("P") or constructed ("C") or
81constructed with indefinite length ("I")
82.RS
83.RE
84.TP
85.B \f[B]off\f[]
86Offset of the encoded element in the unber input stream.
87.RS
88.RE
89.TP
90.B \f[B]tag\f[]
91The tag class and value in human readable form.
92.RS
93.RE
94.TP
95.B \f[B]t_len\f[]
96The length of the TL (BER Tag and Length) encoding.
97.RS
98.RE
99.TP
100.B \f[B]v_len\f[]
101The length of the value (V, encoded by the L), may be "Indefinite".
102.RS
103.RE
104.TP
105.B \f[B]type\f[]
106Likely name of the underlying ASN.1 type (for UNIVERSAL tags).
107.RS
108.RE
109.TP
110.B [\f[B]F\f[]]
111Indicates that the value was reformatted (pretty\-printed).
112This will never appear in the output produced using the \f[B]\-p\f[]
113command line option.
114.RS
115.RE
116.SS Example XML output:
117.PP
118<I O="0" T="[UNIVERSAL 16]" TL="2" V="Indefinite" A="SEQUENCE">
119.PD 0
120.P
121.PD
122\ <P O="2" T="[UNIVERSAL 19]" TL="2" V="2" A="PrintableString">US</P>
123.PD 0
124.P
125.PD
126\ \ <C O="6" T="[UNIVERSAL 16]" TL="2" V="6" A="SEQUENCE">
127.PD 0
128.P
129.PD
130\ \ \ \ <P O="8" T="[UNIVERSAL 2]" TL="2" V="4" A="INTEGER"
131F>832970823</P>
132.PD 0
133.P
134.PD
135\ \ </C O="14" T="[UNIVERSAL 16]" A="SEQUENCE" L="8">
136.PD 0
137.P
138.PD
139</I O="14" T="[UNIVERSAL 0]" TL="2" L="16">
140.SH EXAMPLES
141.PP
142Decode the given Tag/Length sequence specified in hexadecimal form:
143.RS
144.PP
145unber\ \f[B]\-t\f[] "\f[I]bf 20\f[]"
146.RE
147.PP
148Decode the DER file using two\-spaces indentation:
149.RS
150.PP
151unber\ \f[B]\-i\f[] \f[I]2\f[]\ \f[I]filename.der\f[]
152.RE
153.PP
154Decode the binary stream taken from the standard input:
155.RS
156.PP
157cat \f[I]filename.der\f[] | unber \f[B]\-\f[]
158.RE
159.PP
160Decode the binary stream and encode it back into an identical stream
161(see \f[C]enber\f[](1)):
162.RS
163.PP
164cat \f[I]filename.der\f[] | unber \f[B]\-p\f[] \f[B]\-\f[] | enber
165\f[B]\-\f[] > \f[I]filename.ber\f[]
166.RE
167.SH FOOTNOTES
168.PP
169The constructed XML output is not necessarily well\-formed.
170.PP
171When indefinite length encoding is being used, the BER sequence which is
172not terminated with the end\-of\-content octets will cause the
173terminating \f[B]</I>\f[] XML tag to disappear.
174Thus, invalid BER framing directly causes invalid XML output.
175.PP
176The \f[C]enber\f[](1) utility understands such XML correctly.
177.SH SEE ALSO
178.PP
179\f[C]enber\f[](1), \f[C]asn1c\f[](1).
180.SH AUTHORS
181Lev Walkin <vlm@lionet.info>.