Project

General

Profile

PublicKey Info Base » History » Version 15

Yingdi Yu, 07/09/2014 02:11 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 14 Yingdi Yu
User table schema:
53
54
    User(                                       
55
        user_name             BLOB NOT NULL,    
56
        has_default_identity  INTEGER DEFAULT 0,
57
        default_identity      BLOB,             
58
        local_management_cert BLOB NOT NULL,    
59
                                                
60
        PRIMARY KEY (user_name)                 
61
    );
62
63 1 Yingdi Yu
The read access to a user's public key information is not restricted,
64
while the write access to a user's public key information requires authentication.
65
The write access is expressed as signed commands. 
66 5 Yingdi Yu
The signing key can be authenticated only if the key already exists in the corresponding user's PIB tables.
67 4 Yingdi Yu
Each key has its own write access privilege which is defined as:
68 3 Yingdi Yu
69 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]`.
70
* 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.
71 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`.
72 3 Yingdi Yu
73
## PIB Service Protocol 
74
75
PIB service provides an interface to NDN applications for public key info lookup. 
76 1 Yingdi Yu
The interface is defined in terms of NDN packets (interest/data).
77 15 Yingdi Yu
A query to PIB is expressed as a **[signed interest](http://redmine.named-data.net/projects/ndn-cxx/wiki/SignedInterest)**.
78 5 Yingdi Yu
The query interest is defined as:
79
80
    /localhost/pib/[UserName]/[Verb]/[Param]/<signed_interest_security_components>
81
82
`UserName` indicates the tables in which the query should apply.
83
`Verb` indicates the access operation. 
84 8 Yingdi Yu
Four types of operations are defined: `get` (Read), `search` (Read), `update` (Write), and `delete` (Write).
85 5 Yingdi Yu
The operation `get` and `search` are quite similar to each other. 
86
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.
87
`Param` is a TLV block containing parameters of the query.
88
Different types of operations have their own parameters.
89
90
### `Get` Parameters
91
For `get` operation, `Param` is defined as:
92
93
       GetParam := Type
94
                   Filter
95
         Filter := Name | DefaultOf | ListOf
96
      DefaultOf := EntityDesc
97
         ListOf := EntityDesc
98
     EntityDesc := Type
99
                   Name
100
           Type := ID | KEY | CERT
101
102
`Type` indicates which table the query will be applied eventually.
103
`Filter` indicates how to apply the query. 
104
When `Name` is specified in `Filter`, PIB will directly lookup the entry with the same name in the table indicated by `Type`.
105
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`.
106
When `ListOf` is specified in `Filter`, PIB will collect all the entries that satisfy the condition specified in `ListOf`. 
107
Here are some examples of `GetParam`:
108
109
    GetParam 
110
    {
111
      Type: KEY
112
      Filter 
113
      {  
114
        Name: /ndn/edu/ucla/ksk-1234
115
      }
116
    }
117
118
The example above is a query to get a key with the name `/ndn/edu/ucla/ksk-1234`.
119
120
    GetParam
121
    {
122
      Type: CERT
123
      Filter 
124
      { 
125
        DefautOf 
126
        {
127
          Type: ID
128
          Name: /ndn/edu/ucla/alice
129
        }
130
      }
131
    }
132
133
The example above is a query to get the default certificate of an identity `/ndn/edu/ucla/alice`.
134
135
    GetParam
136
    {
137
      Type: CERT
138
      Filter 
139
      { 
140
        ListOf 
141
        {
142
          Type: KEY
143
          Name: /ndn/edu/ucla/ksk-1234
144
        }
145
      }
146
    }
147
148 10 Yingdi Yu
The example above is a query to get a list of certificates of a key `/ndn/edu/ucla/alice`.
149 5 Yingdi Yu
150
### `Search` Parameters
151
152
The parameters of `search` operation is quite similar to `get` operation except that there is no `ListOf` filter.
153
154
    SearchParam := Type
155
                   Filter
156
         Filter := Name | DefaultOf
157
      DefaultOf := EntityDesc
158
     EntityDesc := Type
159
                   Name
160 1 Yingdi Yu
           Type := ID | KEY | CERT
161 10 Yingdi Yu
162
The response to `search` operation is a boolean value to indicate the existence of the searched entity 
163 5 Yingdi Yu
164
### `Update` Parameters
165
166
The parameters of `update` operation are defined as: 
167
168
    UpdateParam := Entity
169
                   DefaultOpt
170
         Entity := Identity | PublicKey | Certificate
171
       Identity := Name
172
      PublicKey := Name
173
                   Bytes
174
    Certificate := Bytes
175
     DefaultOpt := USER_DEFAULT | ID_DEFAULT | KEY_DEFAULT | NO_DEFAULT
176
177 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,
178 1 Yingdi Yu
and change the default setting according to `DefaultOpt`.
179
180 8 Yingdi Yu
### `Delete` Parameters
181 1 Yingdi Yu
182 8 Yingdi Yu
The parameters of `delete` operation are defined as: 
183
184
    DeleteParam := EntityDesc
185
     EntityDesc := Type
186
                   Name
187
           Type := ID | KEY | CERT
188
189 11 Yingdi Yu
The entity and its belonging entities will be deleted once the operation is validated.
190 8 Yingdi Yu
191 1 Yingdi Yu
### TLV-TYPE assignments
192
193
Type                                        | Assigned value    | Assigned value (hex)
194
------------------------------------------- | ----------------- | --------------------
195
GetParam                                    | 128               | 0x80
196
SearchParam                                 | 129               | 0x81
197
UpdateParam                                 | 130               | 0x82
198 8 Yingdi Yu
DeleteParam                                 | 131               | 0x83
199
Type                                        | 132               | 0x84
200
Filter                                      | 133               | 0x85
201
Name                                        | 134               | 0x86
202
DefaultOf                                   | 135               | 0x87
203
ListOf                                      | 136               | 0x88
204
EntityDesc                                  | 137               | 0x89
205
Entity                                      | 138               | 0x8a
206
Identity                                    | 139               | 0x8b
207
PublicKey                                   | 140               | 0x8c
208
Certificate                                 | 141               | 0x8d
209
Bytes                                       | 142               | 0x8e 
210
DefaultOpt                                  | 143               | 0x8f 
211 5 Yingdi Yu
212
213
### Constant value assignments
214
215
For type `Type`:
216
217
Constant                                    | Assigned value    | Assigned value (hex)
218
------------------------------------------- | ----------------- | --------------------
219
ID                                          | 0                 | 0x00
220
KEY                                         | 1                 | 0x01
221
CERT                                        | 2                 | 0x02
222
223
For type `DefaultOpt`:
224
225
Constant                                    | Assigned value    | Assigned value (hex)
226
------------------------------------------- | ----------------- | --------------------
227 1 Yingdi Yu
NO_DEFAULT                                  | 0                 | 0x00
228
USER_DEFAULT                                | 1                 | 0x01
229
ID_DEFAULT                                  | 2                 | 0x02
230
KEY_DEFAULT                                 | 3                 | 0x03
231 12 Yingdi Yu
232
### Query Responses
233
234
The response to a query interest is a data packet signed by PIB.
235
The public key certificate of PIB is stored in a read-only file and is accessible to all users on the system.
236
 
237
The content of the response to `get` operation could be one of the three TLV defined above: `Identity` (0x8b), `PublicKey` (0x8c), and `Certificate` (0x8d), or a list of these TLVs.
238
The content of the response to `search` operation is a byte. Non-zero byte stands for true while 0x00 stands for false.
239 13 Yingdi Yu
The content of the response to `update` or `delete` operation is a byte which serves as an error code. 
240 1 Yingdi Yu
0x00 stands for success while non-zero byte stands for failure. 
241 13 Yingdi Yu
242
Error code for `update`:
243
244
Error code              | Value             | Description
245
----------------------- | ----------------- | --------------------
246
ERR_SUCCESS             | 0                 | No error
247
248
Error code for `delete`:
249
250
Error code              | Value             | Description
251
----------------------- | ----------------- | --------------------
252
ERR_SUCCESS             | 0                 | No error