previous | start | next

Basic Encoding Rules - Transfer Syntax for ASN.1

These rules describe how an entity, defined using ASN.1, is encoded for transmission. In ASN.1, it is said to "disambiguate" a stream of bytes arriving over a network, in that both the type and value of an entity can be determined immediately. BER specifies that an ASN.1 object is encoded as a TAG, followed by a LENGTH and then a VALUE -- ie, TLV encoding: thus:
TLV encoding
The TAG is (usually) encoded in a single octet, containing its value (see earlier) in binary in the low-order 5 bits and some other information in the remaining 3 bits[1].
 
The LENGTH can be encoded in two possible ways, definite (which usually only requires a single octet, and is the most common) and indefinite (which requires, at least, several more octets).
 
The VALUE field is encoded using a specified method which is appropriate to its type - for example, an INTEGER is sent as its binary 2's complement equivalent; an OCTET STRING is simply the appropriate octets.
 
[1] The CLASS (see slide 4) of the object (most significant 2 bits), and whether it is a simple or constructed (structured) data type (1 bit: 0 for simple, 1 for constructed).
Lecture 22: Network Management #2 Copyright © 2005 P.Scott, La Trobe University Bendigo.


previous | start | next