The 16 Universal Types are defined in ISO/CCITT
X/409. These types, shown in #tbt72#1619> form the basic elements from which all
other ASN.1 constructions can be defined.
#table1620#
Table: ASN.1 Predefined Types
ID Codes 0, 16 and 17 are ;SPM_quot;special;SPM_quot;
-
Code 0 denotes End of Contents when indefinite length
form objects are used. This requires that the input
stream be scanned continuously object by object until
this ;SPM_quot;token;SPM_quot; is recognized, so indefinite length
objects are frequently encoded as sequences of known
length ;SPM_quot;fragments;SPM_quot; to improve processing overheads.
-
Code 16 introduces an ordered list of items of any
type.
-
Code 17 introduces a set of unordered items of any
type.
-
Since both of the last two items allow for recursive
use, and a notation for choice also exists, any set or
sequence -derived structure can be built.
ASN.1 Construction Rules
These are the Backus-Naur Form (BNF) representations of the
basic rules for constructing and Reading ASN.1
specifications.
You must be careful to distinguish between:
-
BNF notation for specifying the ASN.1
-
Actual ASN.1 syntax itself.
-
In the BNF, not all terminal objects are quoted, following
the practice of quoting symbols which may conflict with BNF
but allowing plaintext to be entered unquoted where it is
unambiguous. General BNF Rules used. (from X400)
-
Symbols rendered in bold are nonterminals
-
All other symbols are terminals.
-
The Terminals ;SPM_quot;::=;SPM_quot;,;SPM_quot;|;SPM_quot;,;SPM_quot;string;SPM_quot;,;SPM_quot;identifier;SPM_quot;, ;SPM_quot;number;SPM_quot;
and ;SPM_quot;empty;SPM_quot; are quoted to distinguish them from the BNF
operators, and any built-in non-terminals listed
immediately below them.
-
Non-terminals whose first letter is capital are defined
in the grammar
-
Other non-terminals, of which there are four are
defined here:
-
non-terminal string is a sequence of zero or more
characters.
-
non-terminal identifier is a sequence of one or
more characters chosen from the capital letters,
the small letters, the decimal digits and the
hyphen; the first letter must be a letter. case
is significant and distinguishes one identifier
from another.
-
non-terminal number denotes a non-negative integer
and has two forms: the first specifies the
integers value in decimal (radix 10) notation, it
is a sequence of one or more decimal digits. the
second specifies the integers value in hexadecimal
(radix 16) notation, it is a sequence of one or
more hexadecimal digits followed by the letter ;SPM_quot;H;SPM_quot;.
To aid clarity Binary values may be subscripted
with ;SPM_quot;2;SPM_quot;, Hexadecimal values with ;SPM_quot;16;SPM_quot; and decimal
left unsubscripted.
-
non-terminal empty denotes the null or empty
string of symbols.
-
Comments are embedded in the notation, proceeded by two
hyphens ;SPM_quot;--;SPM_quot; and ended by two hyphens or the end of a
line.