ASN.1 Tools for C

The OSS® ASN.1 Tools for C is a complete development toolkit for rapidly building applications using ASN.1. This product features a powerful ASN.1:2015 capable compiler, a runtime library with ASN.1 BER, CER, DER, PER, OER, XER, CXER and E-XER encoder/decoder engines, and a rich collection of utilities to simplify and speed your development. The OSS ASN.1 Tools for C fully support 4G (LTE: RRC, S1, and X2 protocols).

The compiler takes ASN.1 specifications as input, and generates C language data structures plus control tables for encoding and decoding. The OSS compiler offers extensive diagnostic capabilities to minimize your development time and effort.

A set of runtime libraries provides ASN.1 encoding and decoding functions and valuable auxiliary functions to operate on application messages. The OSS runtime libraries have been ported to 500+ platforms, including many embedded platforms.

Support for JSON ER allows serializing ASN.1 data to the popular JSON format and converting between JSON messages and ASN.1 binary messages.

Support for OER allows working with ASN.1 binary messages that can be encoded/decoded significantly faster than BER and PER messages, while being only slightly less compact than PER messages.


Support for E-XER allows generation of XML compatible with output from XML Schema tools.

If you need high speed encoding/decoding and the smallest possible memory footprint, look no further. Simply put, the OSS ASN.1 Tools for C are the most optimized ASN.1 tools you will ever find.

ASN.1 Tools for C features

  • unparalleled speed of encoders and decoders
  • backward compatibility guaranteed
  • ASN.1 Studio, an intuitive IDE for ASN.1 specification editing and message analysis
  • large (1024 bit) INTEGERs (for cryptographic applications)
  • unlimited value size
  • type representations which reflect the semantics of ASN.1 (4 byte UniversalStrings, Time classes)
  • encoding of extensible types (unknown extensions)
  • improve your performance with optional customization of automatic decoding
  • automatic decoding for any kind of constraint
  • no implementation restrictions; never rewrite your ASN.1 to accommodate encoding limitations
  • defer decoding of any individual field or type
  • file and socket support
  • concatenated PDU support
  • contents constraints (full support)
  • generate XML stylesheet or DTD for each PDU

ASN.1/C Compiler

The ASN.1 compiler is a standalone program that takes one or more input files, where each input file contains one or more ASN.1 modules. The compiler verifies that the specification is valid, and generates:

  • diagnostic messages and optionally an output ASN.1 listing
  • easy to use C language data structures to be included in your application
  • a control table for use by the space-optimized or lean encoder/decoder
  • a time-optimized encoder/decoder.

(the Lean Encoder Decoder is provided in a separate package)

Cross compiling is supported by the ASN.1 Tools for C. Cross compiling enables a developer to produce files that can be used on a different operating system than the one the compiler runs on. Maximize your investment with the ability to cross-compile. Learn more about cross-compilation.



The OSS encoders/decoders provide, among many other features, the ossEncode() and ossDecode() functions. The ossEncode() function takes data placed by your application program in the compiler-generated C data structures and converts it to a string of bytes encoded according to BER, CER, PER, OER, DER, XER, CXER or E-XER.

The other function, ossDecode(), takes a string of bytes that have been encoded according to BER, CER, PER, OER, DER, XER, CXER or E-XER and performs the inverse operation of the encoder, resulting in a C data structure that you can easily manipulate.

TLV Print Utility

This utility, included with the ASN.1 Tools for C, takes a BER or DER encoding in ASCII or binary format from an input file and writes it to an output file in one of three different type-length-value (TLV) formats.

The space-optimized encoder/decoder (SOED) is so named because its emphasis is on minimizing use of memory, especially when the abstract syntax is large or complex. Both the encoder and decoder possess a simple yet flexible memory management interface as well as a wealth of tracing, error trapping, diagnostic and recovery capabilities.

The time-optimized encoder/decoder (TOED) has a program call interface identical to the space-optimized encoder/decoder's and performs the same function (except that it does not possess any tracing capability), but its emphasis is on minimizing CPU utilization.


The OSS runtime libraries have been ported to 500+ platforms, including many embedded platforms.

More functionality

Runtime functions, supporting PDU copying, comparing, printing and more, make your application development process easier.

Interpretive ASN.1 API

The Interpretive ASN.1 API (IAAPI), included at no extra cost in the ASN.1 Tools for C, can be used in conjunction with the regular ASN.1/C compiler (when the ASN.1 schema is compiled at the time when the application is developed), or with OSS' Compile-And-Go Library (CAGL) (when the schema is compiled dynamically at runtime).

IAAPI provides means to get information about the details of a compiled ASN.1 schema, including the types it defines (say, a record with multiple components), the fields of a type (say, an integer and a string) and the constraints associated with them (say, a smaller-than-10 integer). This information allows developers to write code that parses the content of a message, which is particularly useful when its structure is unknown at application development time. Similarly, developers can write code to create, field by field, a new message, so long as its format obeys the schema compiled.


Standards Conformance

This powerful software conforms fully to the ASN.1 standards listed below:

  • ITU-T X.696 (ISO/IEC 8825-7) - Octet Encoding Rules (OER) Base Protocol

  • ITU-T X.680 (ISO/IEC 8824-1) - Abstract Syntax Notation One (ASN.1): Specification of Basic Notation

  • ITU-T X.681 (ISO/IEC 8824-2) - Abstract Syntax Notation One (ASN.1): Information Object Specification

  • ITU-T X.682 (ISO/IEC 8824-3) - Abstract Syntax Notation One (ASN.1): Constraint Specification

  • ITU-T X.683 (ISO/IEC 8824-4) - Abstract Syntax Notation One (ASN.1): Parameterization of ASN.1 Specifications

  • ITU-T X.690 (ISO/IEC 8825-1) - ASN.1 Encoding Rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)

  • ITU-T X.691 (ISO/IEC 8825-2) - ASN.1 Encoding Rules: Specification of Packed Encoding Rules (PER)

  • ITU-T X.692 (ISO/IEC 8825-3) - ASN.1 Encoding Rules: Specification of Encoding Control Notation (ECN)

  • ITU-T X.693 (ISO/IEC 8825-4) - ASN.1 Encoding Rules: Specification of XML Encoding Rules (XER). This includes the Canonical XML Encoding Rules (CXER) specification, and Extended XML Encoding Rules (E-XER).

ASN.1 Tools for C — Runtime Choices

Throughout the years, OSS Nokalva's customers have had many different requirements for code size, encoding/decoding speed and diagnostic capabilities on various mainstream and embedded platforms. To satisfy our customers' various needs, OSS Nokalva offers our ASN.1 Tools for C runtime libraries in three flavors.

All three flavors of the runtime libraries perform the same function and have an identical API consisting of functions for encoding/decoding ASN.1 messages, functions for copying, comparing, printing, and freeing unencoded/decoded messages, a simple, yet flexible memory management interface, and many other useful functions.

You can change from using one flavor of the ASN.1/C runtime to using another with no impact to your application code. See the "ASN.1/C Runtime API" manual for detailed instructions on how to switch between the various runtime flavors.


The Space-Optimized Encoder/Decoder (SOED) was so named because of its emphasis on minimizing memory usage (i.e., small code size), especially when the ASN.1 specification is large or complex. SOED is a popular choice for use during development. It offers a wealth of tracing, error trapping, diagnostic and recovery capabilities, our most flexible memory manager, and the ability to work interactively with an ASN.1 specification (which is useful, for example, when you need to read information about the constraints of a particular ASN.1 type at runtime).


The time-optimized encoder/decoder (TOED) is a popular choice for deployment because of its emphasis on minimizing CPU utilization. We purposely minimized the tracing capability and used a code-driven rather than table-driven design to achieve lightning speed.

LED (packaged separately)

The lean encoder/decoder (LED) is optimized to offer a smaller code size than the SOED, yet fast encode/decode performance. It purposely does not possess a wealth of tracing and diagnostic capabilities. It is often the best choice for working with large ASN.1 specifications, particularly when your software runs on systems with significant memory constraints.

Which ASN.1/C Runtime is Right for Me?

Use the table below to choose the ASN.1/C runtime that best suits your needs, based on its performance (expressed as both code size and the speed of encoding) and diagnostic capabilities.





Encoding/Decoding Speed




Code Size(1)




Diagnostic Capabilities




Ideal for Use During

Development and Deployment



Best Suited for

  • Diagnosis during development
  • Applications used for testing
  • Applications that need to encode/decode messages without prior knowledge of ASN.1 types and constraints
  • Large/complex ASN.1 specs
  • Memory limitations
  • Small ASN.1 specs
  • Very high speed requirements
  • Large ASN.1 specs
  • High speed requirements
  • Memory limitations

Runtime Performance Comparison

The following charts depict runtime performance results based on several standard ASN.1 specifications to help you get a feel for the comparative performance (code size and time spent during encoding/decoding) of each of the ASN.1/C runtime flavors.

If you can't find your ASN.1 specification below, you can approximate the relative performance of SOED/TOED/LED based on the size of your specification and/or the encoding rule used.

Performance Comparison Methodology

The encoding/decoding times and executable sizes for all ASN.1 specifications are presented relative to the smallest ones (1x). The encoding/decoding time was averaged for several different messages and normalized based on the size of the messages. For both charts, an exponential scale was used. Smaller bars reflect better performance.

The same generic encoding/decoding application was used for all measurements. The size of the application object code was compared, which was obtained from C-compiling and linking the sources and the control table (if applicable) generated by the ASN.1 compiler, as well as the application code and the corresponding runtime libraries.

Feature ASN.1/

Support for OER


Speed. Don't settle for snail-paced ASN.1 tools.
Both our compiler and runtime are fast. We invite you to evaluate our tools and see for yourself.

Fastest Faster Fast Fast

Support for encoder/decoder with debug and tracing capabilities (SOED).


Support for interpretive encoder/decoder designed for a small memory footprint (LED).
OSS' tools can meet your code size requirements no matter which protocol specified with ASN.1 that you use.


Support for compiler-generated encoder/decoder designed for speed (TOED).


Encoding to file or socket in a few lines of code
OSS offers socket support for all encoding rules for any value of any type. Improve the performance of your application. No need to store values in temporary memory. You only need to write one or two lines of code.

Quality Tracing and Precise Error Messages
OSS ASN.1 tools provide a wealth of diagnostics, giving you the information you need, in the format you need, on the platform you want. Don't settle for ASN.1 tools that are miserly with debugging information, thus slowing you down.

No need to worry about backward compatibility between versions of your ASN.1 - your own or the programs with which you communicate.

Relay Safe Mode 
Allows decoding a message with extensions using a different version of the ASN.1 spec and then preserve those extensions when re-encoding.


Get full support including options to determine which types are generated.


Compare and Copy Value
Avoid having to write code to copy or compare and save on implementation time. You can compare any 2 values, or make a copy of any value, regardless of the value's complexity, all with one simple function call.

Constraint Checking
Check all, some, or no constraints. That includes pattern constraints and contents constraints. Invalid values are caught at compile time and runtime, not silently ignored.

Large Values for All Encoding Rules
If you have values that are too large to fit in memory, you'll need this feature. OSS supports large values for all encoding rules, no matter what nesting depth the value has within the PDU.


Change runtime options dynamically with ease
Flexibility at runtime allows you to change options on the fly. For example, encoding rules can be changed so that you can decode with XER and then re-encode with PER.

Access to ASN.1 without foreknowledge of the data
Via the IAAPI you can generically access ASN.1 types, subtypes, and values without having the name or the structure of the data.


Value Notation Format I/O
Print values in value notation format, and read values with the OSS runtime function that parses value notation.

Nesting limits
For recursively defined constructed types and strings, these limits keep your program secure from undesirable invalid encodings. For ASN.1/C, you can even override the default limits.


Support of J2ME CLDC 1.1 (Connected Limited Device Configuration)
The CLDC is a specification of a framework for Java ME applications targeted at devices with very limited resources, such as pagers and mobile phones. The OSS ASN.1 Compiler for Java can now generate Java classes compatible with the J2ME CLDC 1.1 platform. New CLDC 1.1 compatible runtime jar files have been introduced to encode/decode ASN.1 binary and XML messages.

Quick Navigation;

© Copyright 2000-2017  COGITO SOFTWARE CO.,LTD. All rights reserved.