Project

General

Profile

PublicKey Info Base » History » Version 7

Yingdi Yu, 07/08/2014 05:07 PM

1 1 Yingdi Yu
Public key Info Base (PIB) Service
2
==================================
3
4
## Public Key Info Management 
5
6
NDN data packets are secured through digital signatures.
7 2 Yingdi Yu
In order to generate a valid signature, an NDN application needs to know not only the correct key to use but also the correct public key information that should be put into the `KeyLocator` of a data packet. 
8
The information needs to be managed locally on the system where the application is running.
9
10
The information related to keys is managed at three granularities: identities, keys, and certificates. 
11
A key is always associated with a namespace, called "identity".
12 4 Yingdi Yu
An identity however may have more than one keys.
13
Each key is named as `/<Identity>/[KeyId]`. 
14
The `KeyId` uniquely identifies a key which belongs to the `Identity`.
15 2 Yingdi Yu
Among these keys, only one is the default key of the identity.
16
If only identity is provided when signing a packet, the default key of the identity will be used to sign the packet.
17
18
A certificate is always associated with the key in the certificate
19
If a certificate is provided when signing a packet, the corresponding private key should be used to sign the packet 
20
and the name of the certificate name may be put into the `KeyLocator` of the packet.
21
22
A key may have more than one certificates (e.g., certificates may be issued by different parties).
23
Among these certificates, only one is the default certificate of the key.
24
The default certificate of the default key of an identity is the default certificate of the identity.
25
If only identity is provided when signing a packet, the name of the default certificate of the identity may be put into the `KeyLocator` of the packet.
26
27 3 Yingdi Yu
All the information above may be accessed by different APIs and applications on the same system, 
28
therefore it is desirable to make the information provisioning as a system service. 
29 1 Yingdi Yu
30 3 Yingdi Yu
Since public keys and certificates are supposed to be publicly available, 
31
the service also serves as a local storage of certificate and public keys, 
32
besides providing the public key related information.
33 1 Yingdi Yu
34 3 Yingdi Yu
## PIB management model
35 1 Yingdi Yu
36 3 Yingdi Yu
The public key information of each system user is managed separately in PIB.
37
For now, PIB service is a system service (i.e., run by root).
38
PIB service may be separated into several user services (i.e., run by each user) in the future.
39 1 Yingdi Yu
40 3 Yingdi Yu
Each user has three tables in PIB: identity table, key table, and certificate table.
41 1 Yingdi Yu
The public key information of a user is managed in these tables.
42 4 Yingdi Yu
Identity table consists of two columns: `identity` (primary key) and `default_key_id`.
43
Key Table consists of five columns: `identity`, `key_id`, `key_type`, `key_bits`, and `default_cert_name`. 
44
The combination of `identity` and `key_id` is the primary key of key table.
45
Certificate table consists of four columns: `certificate_name` (primary key), `identity`, `key_id`, and `certificate_data`.
46
47
Besides the tables for each user, PIB has two more management tables: user table and certificate_publishing table.
48
User table stores user's local management key (we will discuss it later) and user's default identity
49 3 Yingdi Yu
Each user has its own default identity. 
50
From the default identity, the default key and certificate of the user can be derived.
51 1 Yingdi Yu
52
The read access to a user's public key information is not restricted,
53
while the write access to a user's public key information requires authentication.
54
The write access is expressed as signed commands. 
55 5 Yingdi Yu
The signing key can be authenticated only if the key already exists in the corresponding user's PIB tables.
56 4 Yingdi Yu
Each key has its own write access privilege which is defined as:
57 3 Yingdi Yu
58 4 Yingdi Yu
* The root user has the **root key** of the local system. The root key has the highest privilege, i.e., its owner is allowed to change anything in PIB. The identity of the root key is `/localhost`, and the name of the root key should be `/localhost/[KeyId]`.
59
* Each user has its own **local management key**. The local management key is allowed to change anything in the user's PIB info including the three tables and user's own entry in the user table. The identity of the user local management key is `/localhost/user/[UserName]`, and the name of the key should be `/localhost/user/[UserName]/[KeyId]`. Note that the local management key of the root user is the root key.
60 6 Yingdi Yu
* All the other keys are called **regular keys**. A regular key is allowed to change keys/certificates with identities under the key's own namespace, e.g., a key with the identity `/ndn/ucla/alice` is allowed to change a key with the identity `/ndn/ucla/alice/chat` but is not allowed to change a key with the identity `/ndn/ucla/bob`.
61 3 Yingdi Yu
62
## PIB Service Protocol 
63
64
PIB service provides an interface to NDN applications for public key info lookup. 
65 1 Yingdi Yu
The interface is defined in terms of NDN packets (interest/data).
66
A query to PIB is expressed as a **[signed interest](http://redmine.named-data.net/projects/nfd/wiki/Signed_Interests)**.
67 5 Yingdi Yu
The query interest is defined as:
68
69
    /localhost/pib/[UserName]/[Verb]/[Param]/<signed_interest_security_components>
70
71
`UserName` indicates the tables in which the query should apply.
72
`Verb` indicates the access operation. 
73
Three types of operations are defined: `get` (Read), `search` (Read), and `update` (Write).
74
The operation `get` and `search` are quite similar to each other. 
75
The only difference is that the response to `get` is the queried entity per se while the response to `search` operation is the existence (a boolean value) of the queried entity.
76
`Param` is a TLV block containing parameters of the query.
77
Different types of operations have their own parameters.
78
79
### `Get` Parameters
80
For `get` operation, `Param` is defined as:
81
82
       GetParam := Type
83
                   Filter
84
         Filter := Name | DefaultOf | ListOf
85
      DefaultOf := EntityDesc
86
         ListOf := EntityDesc
87
     EntityDesc := Type
88
                   Name
89
           Type := ID | KEY | CERT
90
91
`Type` indicates which table the query will be applied eventually.
92
`Filter` indicates how to apply the query. 
93
When `Name` is specified in `Filter`, PIB will directly lookup the entry with the same name in the table indicated by `Type`.
94
When `DefaultOf` is specified in `Filter`, PIB will first derive the name of the target through the default information and lookup the entry in the table indicated by `Type`.
95
When `ListOf` is specified in `Filter`, PIB will collect all the entries that satisfy the condition specified in `ListOf`. 
96
Here are some examples of `GetParam`:
97
98
    GetParam 
99
    {
100
      Type: KEY
101
      Filter 
102
      {  
103
        Name: /ndn/edu/ucla/ksk-1234
104
      }
105
    }
106
107
The example above is a query to get a key with the name `/ndn/edu/ucla/ksk-1234`.
108
109
    GetParam
110
    {
111
      Type: CERT
112
      Filter 
113
      { 
114
        DefautOf 
115
        {
116
          Type: ID
117
          Name: /ndn/edu/ucla/alice
118
        }
119
      }
120
    }
121
122
The example above is a query to get the default certificate of an identity `/ndn/edu/ucla/alice`.
123
124
    GetParam
125
    {
126
      Type: CERT
127
      Filter 
128
      { 
129
        ListOf 
130
        {
131
          Type: KEY
132
          Name: /ndn/edu/ucla/ksk-1234
133
        }
134
      }
135
    }
136
137
The example above is a query to get a list of certificates of a key `/ndn/edu/ucla/alice`. 
138
139
### `Search` Parameters
140
141
The parameters of `search` operation is quite similar to `get` operation except that there is no `ListOf` filter.
142
143
    SearchParam := Type
144
                   Filter
145
         Filter := Name | DefaultOf
146
      DefaultOf := EntityDesc
147
     EntityDesc := Type
148
                   Name
149
           Type := ID | KEY | CERT
150
151
### `Update` Parameters
152
153
The parameters of `update` operation are defined as: 
154
155
    UpdateParam := Entity
156
                   DefaultOpt
157
         Entity := Identity | PublicKey | Certificate
158
       Identity := Name
159
      PublicKey := Name
160
                   Bytes
161
    Certificate := Bytes
162
     DefaultOpt := USER_DEFAULT | ID_DEFAULT | KEY_DEFAULT | NO_DEFAULT
163
164 7 Yingdi Yu
The operation, once validated, will add a new entry in the corresponding table if no such an entry exists or update the existing entry,
165 1 Yingdi Yu
and change the default setting according to `DefaultOpt`.
166 7 Yingdi Yu
167 5 Yingdi Yu
168
### TLV-TYPE assignments
169
170
Type                                        | Assigned value    | Assigned value (hex)
171
------------------------------------------- | ----------------- | --------------------
172
GetParam                                    | 128               | 0x80
173
SearchParam                                 | 129               | 0x81
174
UpdateParam                                 | 130               | 0x82
175
Type                                        | 131               | 0x83
176
Filter                                      | 132               | 0x84
177
Name                                        | 133               | 0x85
178
DefaultOf                                   | 134               | 0x86
179
ListOf                                      | 135               | 0x87
180
EntityDesc                                  | 144               | 0x90
181
Entity                                      | 145               | 0x91
182
Identity                                    | 146               | 0x92
183
PublicKey                                   | 147               | 0x93
184
Certificate                                 | 148               | 0x94
185
Bytes                                       | 149               | 0x95 
186
DefaultOpt                                  | 150               | 0x96 
187
188
189
### Constant value assignments
190
191
For type `Type`:
192
193
Constant                                    | Assigned value    | Assigned value (hex)
194
------------------------------------------- | ----------------- | --------------------
195
ID                                          | 0                 | 0x00
196
KEY                                         | 1                 | 0x01
197
CERT                                        | 2                 | 0x02
198
199
For type `DefaultOpt`:
200
201
Constant                                    | Assigned value    | Assigned value (hex)
202
------------------------------------------- | ----------------- | --------------------
203
NO_DEFAULT                                  | 0                 | 0x00
204
USER_DEFAULT                                | 1                 | 0x01
205
ID_DEFAULT                                  | 2                 | 0x02
206
KEY_DEFAULT                                 | 3                 | 0x03