Actions

Abstract Syntax Notation One (ASN.1)

Revision as of 20:32, 16 February 2021 by User (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Abstract Syntax Notation One (ASN.1) is an abstract notation for structuring complex data objects. It is a standard, flexible method that
(a) describes data structures for representing, encoding, transmitting, and decoding data
, (b) provides a set of formal rules for describing the structure of objects independent of machine-specific encoding techniques,
(c) is a formal network-management Transmission Control Protocol/Internet Protocol (TCP/IP) language that uses human-readable notation and a compact, encoded representation of the same information used in communications protocols, and
(d) is a precise, formal notation that removes ambiguities.[1]

ASN.1 is a widely used language with supporting tools. It specifies data structures independent of machines, which are directly integrated into tree and tabular combined notation and specification and description languages. While integration with the former enables direct testing of protocols defined using ASN.1, the latter enables specification of associated semantics for ASN.1 data structures. The application area for the standard appears in the structure definition of protocol messages.[2]


ASN.1 Types and Their Universal-Class Tags[3]
Abstract Syntax Notation One, abbreviated ASN.1, is a notation for describing abstract types and values. In ASN.1, a type is a set of values. For some types, there are a finite number of values, and for other types there are an infinite number. A value of a given ASN.1 type is an element of the type's set. ASN.1 has four kinds of type: simple types, which are "atomic" and have no components; structured types, which have components; tagged types, which are derived from other types; and other types, which include the CHOICE type and the ANY type. Types and values can be given names with the ASN.1 assignment operator (::=) , and those names can be used in defining other types and values.

Every ASN.1 type other than CHOICE and ANY has a tag, which consists of a class and a nonnegative tag number. ASN.1 types are abstractly the same if and only if their tag numbers are the same. In other words, the name of an ASN.1 type does not affect its abstract meaning, only the tag does. There are four classes of tag:

  • Universal, for types whose meaning is the same in all applications; these types are only defined in X.208.
  • Application, for types whose meaning is specific to an application, such as X.500 directory services; types in two different applications may have the same application-specific tag and different meanings.
  • Private, for types whose meaning is specific to a given enterprise.
  • Context-specific, for types whose meaning is specific to a given structured type; context-specific tags are used to distinguish between component types with the same underlying tag within the context of a given structured type, and component types in two different structured types may have the same tag and different meanings.

The types with universal tags are defined in X.208, which also gives the types' universal tag numbers. Types with other tags are defined in many places, and are always obtained by implicit or explicit tagging (see Section 2.3). The Table below lists some ASN.1 types and their universal-class tags.


ASN.1 Types and Universal-class tags.png
source: RSA Laboratories


Abstract Syntax Notation One (ASN.1) Elements[4]
Examples of ASN.1 elements include the following:

  • Null: Null elements do not hold any value. They are generally used as placeholders when an element is required but no value is needed.
  • Octet string: string elements hold a set of zero or more octets (bytes) of data. It can be used for holding string or binary data.
  • Boolean: Boolean elements hold values that represent either true or false.
  • Integer: Integer elements hold values that represent integer values.
  • Enumerated: Enumerated elements hold values that represent integer values where each value has a specific meaning.
  • Sequence: Sequence elements are containers that hold zero or more other ASN.1 elements in a manner where the order of the elements is significant.
  • Set: Set elements are containers that hold zero or more other ASN.1 elements in a manner where the order of the elements is not significant.


Abstract Syntax Notation One (ASN.1) Encoding Rules LDAPWiki</ref>
ASN.1 is a general framework for binary encoding, but doesn't actually define how the data should be encoded. That is handled by an encoding rule, and there are a number of different kinds of ASN.1 encoding rules:

  • Basic Encoding Rules (BER)
  • Distinguished Encoding Rules (DER)
  • Canonical Encoding Rules (CER)
  • Packed Encoding Rules (PER)


References

  1. Definition - What is Abstract Syntax Notation One (ASN.1)? NIST
  2. Explaining Abstract Syntax Notation One (ASN.1) Techopedia
  3. ASN.1 Types and Their Universal-Class Tags RSA
  4. Abstract Syntax Notation One (ASN.1) Elements Oracle