Cryptography Reference
In-Depth Information
navigate the hierarchy. Each asn1struct is part of a linked list of other asn-
1struct structures, and each one optionally points to the head of another linked
list that is its child. So, after parsing, the fi rst part of the certifi cate is represented
in memory as shown in Figure 5-8.
constructed: true
tag_class:
tag: 0 × 16
length: 841
data: null
children
constructed: true
tag_class:
tag: 0 × 16
length: 755
data: null
children
constructed: true
tag_class:
tag: 0
03
length: 3
data: null
×
next
children
constructed: false
tag_class:
tag: 0
constructed: true
tag_class:
tag: 0
02
length: 1
data: 2
×
next
03
length: 13
data: null
×
constructed: false
tag_class:
tag: 0
02
length: 9
data: 00 ca 30 e1
8f 77 8d a2 81
×
next
constructed: true
tag_class:
tag: 0
03
length: 13
data: null
×
children
constructed: false
tag_class:
tag: 0 × 06
length: 9
data: 2a 86 48 86
f7 0d 01 01 05
next
constructed: true
tag_class:
tag: 0 × 16
length: 161
data: null
next
constructed: false
tag_class:
tag: 0 × 05
length: 0
data: null
Figure 5.8: Partial illustration of a certificate structure
As you can see, locating a node is a matter of starting at the root, and travers-
ing any number of children or next s until you reach the one you're looking
for. The tree structure is preserved by the use of the children pointers. Defi ne
a handful of constants to clarify the code as shown in Listing 5-4.
 
Search WWH ::




Custom Search