ffasn1dump compiles ASN.1 sources to memory and converts messages from one ASN.1 encoding to another. The supported encodings are BER/DER, aligned PER, unaligned PER, XER, OER, JER and GSER (RFC 3641).
Because the XER, JER or GSER encoding are human readable, it also allows easy editing of ASN.1 messages with a text editor.
ffasn1dump is a free demo of the FFASN1 compiler. This compiler generates efficient and small C code to encode or decode ASN.1 messages in all supported encodings.
No specific installation is needed. The executable ffasn1dump is self contained. On a unix system, you can copy it in /usr/local/bin for example.
Here are a few examples by using the source simpletest.asn from the examples directory:
ObjectList
defined in
simpletest.asn from BER (file simpletest.der) to GSER
(default output format is GSER to console, default input format is
BER):
ffasn1dump simpletest.asn ObjectList simpletest.der
ffasn1dump -I uper simpletest.asn ObjectList simpletest.uper
ffasn1dump -I aper -O der simpletest.asn ObjectList simpletest.aper simpletest.der
ffasn1dump simpletest.asn
Usage:
ffasn1dump [options] asn1source [type infile [outfile]]
module.identifier
).
Options:
help
include additionnal ASN.1 source file(s)
input message format (default=ber).
If random
is used, a valid ASN.1 message with random content is
generated. In this case, infile is a number used as seed by the
random generator.
set output message format (default=gser)
disable constraint check.
decode messages embedded in OCTET STRING or BIT STRING with a CONTAINING constraint. It only works when outputting to GSER, XER or JER. The embedded message is decoded using the input message format specified with -I
.
ffasn1dump supports the following standards: X.680, X.681, X.682, X.683, X.690, X.691, X.693, X.696, X.697 and RFC 3641.
The ANY
type from the older X.208 ASN.1 specification is also
supported.
Limitations:
ffasn1dump is copyright 2011-2023 Fabrice Bellard.
ffasn1dump is available free of charge, but its redistribution on any medium needs written consent of the author.
ffasn1dump is available without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this software.