previous | start | next

Basic Encoding Rules - Transfer Syntax for ASN.1

These are needed to disambiguate a stream of bytes arriving over a network.
 
An ASN.1 object is encoded as a TAG, a LENGTH and a VALUE, (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 maybe some other information[3].
 
The LENGTH can be encoded in two possible ways, definite (which usually only requires a single octet) and indefinite (which requires, at least, several more octets). Both are equally complicated!
 
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.
 
[3]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).

previous | start | next