ASN.1


ASN.1 - An introduction

ASN.1 is the acronym for Abstract Syntax Notation One, a language for describing structured information; typically, information intended to be conveyed across some interface or communication medium. ASN.1 has been standardised internationally. It is widely used in the specification of communication protocols.



Figure 1 - ASN.1 Conversion Principles


The big advantage using ASN.1 is that a network entity or computer has to know only one coding rule for transferred data and that`s ASN.1. The coded data is machine independent. There are ASN.1 compilers which generate C or C++ code from these ASN.1 definitions. The compiler generated encode/decode functions are then compiled and linked on the different computers and can be used by the client software. The machine independency is achieved through the portability of the generated C or C++ code.



C Language Structs vs. ASN.1 Definitions



Figure 2 - ASN.1 Coding Example




ASN.1 Module Example

MyASN1Module DEFINITIONS ::=

BEGIN

EXPORTS EVERYTHING

IMPORTS DataType FROM OtherASN1Module

MyType ::= INTEGER

MySet ::= SET {MyType, DataType, BOOLEAN}

END --MyASN1Module



ASN.1 Predefined Data Types

  • INTEGER
  • REAL
  • BOOLEAN
  • BIT STRING
  • OCTET STRING
  • ENUMERATED
  • OBJECT IDENTIFIER
  • NULL
  • VisibleString
  • UTCTime