Home → ASN.1

Open Source ASN.1 Compiler

The asn1c is a free, open source compiler of ASN.1 specifications into C source code. It supports a range of ASN.1 syntaxes, including ISO/IEC/ITU ASN.1 1988, '94, '97, 2002 and later amendments. The supported sets of encoding rules are

  • BER: ITU-T Rec. X.690 | ISO/IEC 8825-1 (2002) (BER/DER/CER)
  • PER: X.691|8825-2 (2002) (PER).
  • XER: X.693|8825-3 (2001) (BASIC-XER/CXER).

The compiler was written specifically to address security concerns while providing streaming decoding capabilities.

Featureasn1c
Restartable/stream decoding1YES, for BER and XER families
BER (Basic Encoding Rules)YES
DER (a canonical BER subset)YES
CER (another canonical BER subset)yes, read-only2
BASIC-XER (XML Encoding Rules)YES
CXER ("Canonical" XER)YES
EXTENDED-XERno
PER (Packed Encoding Rules)YES, UNALIGNED BASIC PER
Subtype constraintsYES3
Information Object Classesbasic support
C target languageYES
C++ target languageYES4
Java target languageno
Compiled code portability  LP64: Linux/alpha, Linux/amd64
ILP32: MacOS X/powerpc (big-endian), Solaris 9/sparc (big-endian);
   Solaris/x86, FreeBSD/x86, OpenBSD/x86, NetBSD/x86, Linux/x86
(consistency for above platforms is ensured by automated daily testing)
ILP32: Windows-CYGWIN, Windows-MSVC++
(minor manual tweaking required for MS platforms)
EBCDIC supportprovisioned5
LicenseBSD
Cost$0
1) A decoder does not have to have the whole data sequence to start parsing. If it receives less data then required, it will process as much as possible and may be invoked again later, when the next chunk of data becomes available. Question: How to use streaming?
2) Encoding has not been required so far. Please ask for support.
3) The code generator automatically generates constraints checking procedures for PER-visible constraints.
4) C++ compatible C code. No OOP yet.
5) Code has been designed to support EBCDIC charset, but no formal testing has been made yet.

The ASN.1 Compiler Copyright © 2003—2013 Lev Walkin <vlm@lionet.info>