Technical topic: ASN.1 - An introduction to ACN

From TASTE
Revision as of 14:06, 19 March 2019 by Mperrotin (talk | contribs) (Introduction)
Jump to: navigation, search

Introduction

ACN was created as a simple ASN.1-companion language allowing to describe custom binary encodings for complex data structures.

It is useful in the following case:

  • you need to implement a binary packet encoder/decoder for a legacy protocol
  • no standard ASN.1 encoding rules (PER, DER, XER, OER, JER...) fits
  • ECN, the Encoding Control Notation is too complicated or you have no tool available
  • the targeted encoding is not too complex

ACN works in pair with ASN.1 and provides various ways to customize the memory layout of data structures.

Here is a simple example, starting from a basic integer type:

   MyInteger ::= INTEGER (0..7)


If you choose to represent a data of this type using the ASN.1 PER, the encoding will be optimal: 3 bits.

However, your protocol may say that this has to be encoded using 32 bits with a little endian representation. ACN offers the syntax for this:

   MyInteger [size 32, endianness little, encoding pos-int]


ACN aims at being easy to read, powerful enough for real-life cases, and in general very efficient. The following sections detail all the possibilities offered by the language for the various ASN.1 data types.

There are encoding specifications which are not covered by the scope of ACN. For example it is not meant to describe complex textual encodings. Avdanced encoding rules can only be expressed using a notation such as ECN or the non-ASN.1-based DFDL.