Sunday, June 24, 2018

ASN.1 - what is it ?

ASN.1 stands for Abstract Syntax Notation One, a standard protocol from ITU, is heavily used in telecommunication, for example in ISDN.

There is a lot of literature about ASN.1, books, white papers, online tools, etc. so I'm not duplicating here what already exists "out there" but I just sum up few things I think are interesting.

To start to use ASN.1 is a good thing to read the ITU standards, especially the X.680 (basic notation) and X.690 (basic coding/decoding)

ASN.1 takes some time to be understood, is not extremely intuitive, but it has some big advantages, reason why it exists.

  1. it allows to exchange data between different machines
    Or, better put, allows the sender to don't have to know information about the receiver.
    The typical case is when you have two machines with different endian coding (Little Endian vs. Big Endian).
    The Endian coding determine how a machine store datas in the memory.
    Without a standard way to exchange data, who sends data needs to know how the receiver store them and thus format them accordingly.
    Without this information the data will be stored in the wrong way, nullifying the purpose of exchanging data CORRECTLY and thus enhancing the possibility to introduce errors during the data transfer.
  2. it allows to better document the data sent/received
    ASN.1  is a notation human-readable.
    It is easy to build up data structures that can be understood by a human, becoming part of the documentation of the project.
  3. The standards has some default/documented datatype, but is easy to build datatypes related to the specific application. 
  4. It has ready made encoding/decoding libraries
    Especially for big projects, there are ready-made encoders/decoders capable to take the human-readable notation and create the byte-sequence to be sent or decode the byte-sequence received.
  5. It is an international standard
    Very important. Like the point n. 1, using the standard allows easily to send data between machines used in different countries, with different regulations, etc.
    Not only, it is a vendor-independent, platform-independent and language-independent protocol !
I used ASN.1 for many years while developing for ISDN and when possible I still using it when I need to exchange data between different systems.

There are a couple of books that can help a lot to understand ASN.1 :

No comments:

Post a Comment