Investigating ASN.1

Posted on Fri, 20 Jul 2007

While reading the RFCs concerting LDAP (I was doing some research for my Service Discovery essay,) I learned that LDAP uses ASN.1.

ASN.1 is a very mature (and still maintained) ITU standard for specifying the protocol syntax for a protocol. What makes it so cool is that you specify your “abstract syntax” (in a manner similar to a grammar), which you can then compile using an ASN.1 compiler, to turn it into program code for coding/decoding the resultant “transfer syntax” to/from its “concrete syntax” (language-specific form, such as a C structure).

The “transfer syntax” is not specified by the ASN.1 rules, but rather by some encoding rules, such as BER (such as is used in LDAP and SNMP), or PER (useful for more space constrained environments, such a wireless. There is also an XML encoding (XER), and a couple of others.

Many serious systems use ASN.1. Here are but a very few of its uses: ATM machines, Kerberos v5, SSL, RFID, voice and video conferencing, cell-phone messaging... I wonder if QuickTime uses it?

In short, it seems very cool, and I think I shall be writing an essay about it. It will certainly feature in one of my tutorials about specifying packet-based protocols.

More information. On this site you'll find a couple of books that you can download. I'm currently reading the one called “ASN.1 Complete”. I think I'll have to order a printed version, as reading books on a computer is too much of a PITA.