version 6, including all changes.
.
Rev |
Author |
# |
Line |
3 |
PerryLorier |
1 |
An [ISO]/[ITU-T]/[CCITT] standard for transmitting structured data on networks. |
2 |
PerryLorier |
2 |
|
6 |
JohnMcPherson |
3 |
Used by [SSL] Certificates, and many protocols such as [SNMP], [LDAP], various [IBM] Protocols, Z39.50, etc. |
3 |
PerryLorier |
4 |
|
4 |
PerryLorier |
5 |
ASN.1 is a standard for transmitting structured binary data over networks. ASN.1 also is a grammer that can be used to define PDU's to be sent over a network. It's frequently seen as [SNMP] [MIB]s. |
3 |
PerryLorier |
6 |
|
|
|
7 |
ASN.1 is made up of "encoding" of some chunk of data. An encoding is either: |
|
|
8 |
|
4 |
PerryLorier |
9 |
|Identifier Octets|Length Octets|Contents |
3 |
PerryLorier |
10 |
(called the "Definite form") |
|
|
11 |
|
|
|
12 |
or |
|
|
13 |
|
4 |
PerryLorier |
14 |
|Identifier Octets|Length Octets|Contents|End of contets octets |
3 |
PerryLorier |
15 |
(called the "Indefinite form") |
|
|
16 |
|
|
|
17 |
Definate form is in general used when you know the size of something before hand, indefinate form is used when the size of what you are encoding is unknown. |
|
|
18 |
|
|
|
19 |
The Identifier Octets are built up like so: |
|
|
20 |
|1|2|3|4|5|6|7|8 |
5 |
PerryLorier |
21 |
||Class|Constructed|||||Tag |
3 |
PerryLorier |
22 |
|
|
|
23 |
where class is |
|
|
24 |
|Value|Class |
|
|
25 |
|00b|Universal |
|
|
26 |
|01b|Application |
|
|
27 |
|10b|Context specific |
|
|
28 |
|11b|Private |
|
|
29 |
|
|
|
30 |
If constructed is 1, then it means that this is a constructed type, not a primative one. |
|
|
31 |
|
|
|
32 |
The tag says which type it is, if the tag is under <=31, then it's value is used directly, otherwise the tag bits above are set to "11111" and then a sequence of octets that represent the number. The 8th bit of each octet is set to 1 to mean "more octets after this one". The low bits are the 7 bits of the tag, MSB first. |
|
|
33 |
|
|
|
34 |
"Choice" values encode which choice was taken directly into the tag bits. I don't know why. |
|
|
35 |
|
|
|
36 |
In definate encodings, if the 8th bit is 0, then it's a "short" encoding of the length, and the length is the lower 7 bits. If the 8th bit is set, and the lower 7 bits are how many __octets__ are used to encode the length(!). This allows for lengths up to 2**1008. The lower 7 bits being set is reserved for future expansion. |
|
|
37 |
|
|
|
38 |
End of contents is encoded as |
|
|
39 |
|Type|Length|Value |
|
|
40 |
|00|00| Absent |
|
|
41 |
|
|
|
42 |
Boolean is encoded as an octet, 0 for false, non-zero for true. |
|
|
43 |
Integers are encoded as a sequence of bytes, [MSB] first. |
|
|
44 |
Sequences are encoded as a series of encodings. |
4 |
PerryLorier |
45 |
|
|
|
46 |
Encodings: |
|
|
47 |
|Number|Name |
|
|
48 |
|Universal 0|Reserved for encoding rules |
|
|
49 |
|Universal 1|Boolean |
|
|
50 |
|Universal 2|Integer |
|
|
51 |
|Universal 3|Bitstring |
|
|
52 |
|Universal 4|Octet String |
|
|
53 |
|Universal 5|Null type |
|
|
54 |
|Universal 6|Object identifier type |
|
|
55 |
|Universal 7|Object descriptor type |
|
|
56 |
|Universal 8|External type/Instance of type |
|
|
57 |
|Universal 9|Real |
|
|
58 |
|Universal 10|Enumerated Type |
|
|
59 |
|Universal 11|Embedded PDV (Presentation Data Value) Type |
|
|
60 |
|Universal 12-15|Reserved |
|
|
61 |
|Universal 16|Sequence/Sequence-of types |
|
|
62 |
|Universal 17|Set/Set-of types |
|
|
63 |
|Universal 18-22|Charactor String types |
|
|
64 |
|Universal 23-24|Time types |
|
|
65 |
|Universal 25-30|Charactor String types |
|
|
66 |
|Universal 31-..|Reserved |