Finally, the contents field brings carried values described in previous identifier and length fields. For the most parts, simple types have primitive encodings, while structured ones need constructed encodings.
The following table sumarizes encoding for all biult-in types, shows whether an encoding is primitive (P) or constructed(C) and how the various types are represented in available octets or nested encodings.
Type keyword |
P/C |
tag |
description of representation |
INTEGER |
P |
2 |
two's complement binary, minimal number of octets |
REAL |
P |
9 |
various possibilities |
NULL |
P |
5 |
no contents octets |
BOOLEAN |
P |
1 |
single octet: all zeroes equal FALSE, anything else TRUE |
ENUMERATED |
P |
10 |
representing number is encoded as INTEGER |
BIT STRING |
P |
3 |
bits of the value, first octet indicates number uf unused bits in the last octet |
C |
3 |
segmented value | |
OCTET STRING |
P |
4 |
the octets of the value |
C |
4 |
segmented value | |
Character strings |
P |
x |
the octets representing characters in appropriate standard, the tag depends on character set |
C |
x |
segmented value | |
OBJECT IDENTIFIER |
P |
6 |
packed sequence of numbers representing the arc labels |
SET |
C |
17 |
component values, in arbitrary order |
SEQUENCE |
C |
16 |
component values, in the definition order |
SET OF |
C |
17 |
component values, in arbitrary order |
SEQUENCE OF |
C |
16 |
component values, in intended order |
CHOICE |
P/C |
x |
as for type of selected alternative, the same for tag |
ANY |
P/C |
x |
as for type actualy used, the same for tag |
Tagged (implicit) |
P/C |
x |
as for base type |
Tagged (explicit) |
C |
x |
nested encoding of equivalent untagged value |
Useful types |
P/C |
x |
as proprietary useful type is defined |