unber(1)
π unber β the ASN.1 BER Decoder π
ok so bestie, you know how BER-encoded files are literally just vibes and mystery bytes? unber is the girl who walks in, flips on the lights, and tells you exactly what's in there. This is unber(1) from Version 0.9.28 and she is serving structure. π
β¨ SYNOPSIS β¨
unber [-1] [-iindent] [-m] [-p] [-sskip] [-thex-string] [-]
[input-filenames...]
πΈ DESCRIPTION πΈ
unber presents the internal structure of BER-encoded files as a human readable text. A single dash denotes the standard input.
(and like, quick note: the DER and CER formats are subsets of the BER and are also supported. so don't worry, those are covered too. π )
π¦ OPTIONS π¦
-1β Do not 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,unbercontinues decoding until the end of file (input stream). (basically: read one and DIP β)-iindent β Use the specified number of spaces for output indentation. Default is 4 spaces.-mβ Generate shorter output while still preserving BER encoding information. (the lowkey minimalist era)-pβ Do not attempt to pretty-print known ASN.1 types (BOOLEAN, INTEGER, OBJECT IDENTIFIER, etc). By default, some ASN.1 types are converted into the text representation.
π¨ This option is required if theunber(1)output is used as an input toenber(1). Do not skip this one, bestie, fr fr.
-sskip β Ignore the first skip bytes in the input stream; useful for stripping off lower level protocol framing data. (bye bye wrapper bytes π)-thex-string β Interpret the hex-string as a sequence of hexadecimal values representing the start of BER TLV encoding. Print the human readable explanation.-β A single dash denotes the standard input. (yes she's in the option list, she's iconic like that)
π XML FORMAT π
unber dumps the output in the regular XML format which preserves most of the information from the underlying binary encoding. (she's giving structured. she's giving parseable.)
The XML opening tag format is as follows:
<tform O="off" T="tag" TL="t_len" V="{Indefinite|v_len}" [A="type"] [F]>
Where:
- tform β Encoding form the value is in: primitive ("P") or constructed ("C") or constructed with indefinite length ("I")
- off β Offset of the encoded element in the
unberinput stream. - tag β The tag class and value in human readable form.
- t_len β The length of the TL (BER Tag and Length) encoding.
- v_len β The length of the value (V, encoded by the L), may be "Indefinite".
- type β Likely name of the underlying ASN.1 type (for UNIVERSAL tags).
- [F] β Indicates that the value was reformatted (pretty-printed). This will never appear in the output produced using the
-pcommand line option.
π Example XML output π
<I O="0" T="[UNIVERSAL 16]" TL="2" V="Indefinite" A="SEQUENCE">
<P O="2" T="[UNIVERSAL 19]" TL="2" V="2" A="PrintableString">US</P>
<C O="6" T="[UNIVERSAL 16]" TL="2" V="6" A="SEQUENCE">
<P O="8" T="[UNIVERSAL 2]" TL="2" V="4" A="INTEGER" F>832970823</P>
</C O="14" T="[UNIVERSAL 16]" A="SEQUENCE" L="8">
</I O="14" T="[UNIVERSAL 0]" TL="2" L="16">
β EXAMPLES β
Decode the given Tag/Length sequence specified in hexadecimal form:
unber -t "bf 20"
Decode the DER file using two-spaces indentation:
unber -i 2 filename.der
Decode the binary stream taken from the standard input:
cat filename.der | unber -
Decode the binary stream and encode it back into an identical stream (see enber(1)):
cat filename.der | unber -p - | enber - > filename.ber
(the round trip pipeline. the main character moment. periodt.)
π FOOTNOTES π
The constructed XML output is not necessarily well-formed. (yes, it said that. yes, it's real.)
When indefinite length encoding is being used, the BER sequence which is not terminated with the end-of-content octets will cause the terminating </I> XML tag to disappear. Thus, invalid BER framing directly causes invalid XML output.
The enber(1) utility understands such XML correctly. π«Ά
π§ SEE ALSO π§
π AUTHORS π
Lev Walkin <vlm@lionet.info>.
and that's the whole page, bestie π β ASN.1 BER Decoder, dated 2016-01-23, and it's unber(1) forever and always. slay, go decode something. π¦β¨
π¦ where this page comes from
- debian bookworm: asn1c 0.9.28+dfsg-5 Β· BSD-2-Clause
- debian trixie: asn1c 0.9.28+dfsg-5 Β· BSD-2-Clause
- ubuntu jammy: asn1c 0.9.28+dfsg-3 Β· BSD-2-Clause
- ubuntu noble: asn1c 0.9.28+dfsg-5 Β· BSD-2-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms