blob: 0bb059ff55acaf04383637f04dda579b223f07bf [file] [log] [blame]
Yingdi Yufba8a632015-06-08 22:25:54 -07001NDN Certificate Format Version 2.0
2==================================
3
4.. contents::
5
6Since signature verification is a common operation in NDN applications, it is
7important to define a common certificate format to standardize the public key
8authentication procedure. As every NDN data packet is signed, a data packet
9that carries a public key as content is conceptually a certificate. However,
10the specification of a data packet is not sufficient to be the specification of
11a common certificate format, as it requires additional components. For example,
12a certificate may follow a specific naming convention and may need to include
13validity period, revocation information, etc. This specification defines
14naming and components of the NDN certificates and is complementary to NDN packet
15specification.
16
17::
18
19 Overview of NDN certificate format
20 +--------------------------+
21 | Name |
22 +--------------------------+
23 | MetaInfo |
24 |+------------------------+|
25 || ContentType: KEY(2) ||
26 |+------------------------+|
27 +--------------------------+
28 | Content |
29 |+------------------------+|
30 || Public Key ||
31 |+------------------------+|
32 +--------------------------+
33 | SignatureInfo |
34 |+------------------------+|
35 || SignatureType: ... ||
36 || KeyLocator: ... ||
37 || ValidityPeriod: ... ||
38 || ... ||
39 |+------------------------+|
40 +--------------------------+
41 | SignatureValue |
42 +--------------------------+
43
44
45Name
46----
47
48The name of a certificate consists of four parts as shown below:
49
50::
51
52 /<PrincipalName>/[KeyId]/KEY/[Version]
53
54A certificate name starts with the name to which a public key is bound. The
55second part is a single name component, called KeyId, which should uniquely
56identify the key under the principal namespace. The value of KeyId is up to
57the owner of the principal namespace (e.g., SHA-256 digest of the public key,
58timestamp, or numerical identifier). A special name component ``KEY`` is
59appended after KeyId, which indicates that the data is a certificate. The last
60component is version number. For example,
61
62::
63
64 /edu/ucla/cs/yingdi/%03%CD...%F1/KEY/%FD%d2...%8E
65 \_________________/\___________/ \___________/
66 Principal Name Key ID Version
67
68
69MetaInfo
70--------
71
72The ``ContentType`` of certificate is set to ``KEY`` (2).
73
74The ``FreshnessPeriod`` of certificate must be explicitly specified. The
75recommended value is 1 hour (3,600,000 milliseconds).
76
77Content
78-------
79
80By default, the content of a certificate is the public key encoded in
81`X509PublicKey <https://tools.ietf.org/html/rfc5280#section-4.1.2.7>`__ format.
82
83SignatureInfo
84-------------
85
86Besides, ``SignatureType`` and ``KeyLocator``, the ``SignatureInfo`` field of a
87certificate include more optional fields.
88
89::
90
91 SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
92 SignatureType
93 KeyLocator
94 ValidityPeriod?
95 ... (SignatureInfo Extension TLVs)
96
97One optional field is ``ValidityPeriod``, which contains two sub TLV fields:
98``NotBefore`` and ``NotAfter``, which are two UTC timestamps in ISO 8601 compact
99format (``yyyymmddTHHMMSS``, e.g., "20020131T235959"). NotBefore indicates
100when the certificate takes effect while NotAfter indicates when the certificate
101expires.
102
103.. note::
104 Using ISO style string is the convention of specifying validity period of
105 certificate, which has been adopted by many certificate systems, such as
106 X.509, PGP, and DNSSEC.
107
108::
109
110 ValidityPeriod ::= VALIDITY-PERIOD-TYPE TLV-LENGTH
111 NotBefore
112 NotAfter
113
114 NotBefore ::= NOT-BEFORE-TYPE TLV-LENGTH
115 BYTE{15}
116
117 NotAfter ::= NOT-AFTER-TYPE TLV-LENGTH
118 BYTE{15}
119
120For each TLV, the TLV-TYPE codes are assigned as below:
121
122+---------------------------------------------+-------------------+----------------+
123| TLV-TYPE | Assigned code | Assigned code |
124| | (decimal) | (hexadecimal) |
125+=============================================+===================+================+
126| ValidityPeriod | 253 | 0xFD |
127+---------------------------------------------+-------------------+----------------+
128| NotBefore | 254 | 0xFE |
129+---------------------------------------------+-------------------+----------------+
130| NotAfter | 255 | 0xFF |
131+---------------------------------------------+-------------------+----------------+
132
133.. note::
134 TLV-TYPE code that falls into [253, 65536) is encoded in
135 `3-byte <http://named-data.net/doc/ndn-tlv/tlv.html#variable-size-encoding-for-type-t-and-length-l>`__
136
137Extensions
138~~~~~~~~~~
139
140A certificate may optionally carry some extensions in SignatureInfo. An extension
141could be either critical or non-critical depends on the TLV-TYPE code convention. An
142critical extension implies that if a validator cannot recognize or cannot parse the
143extension, the validator must reject the certificate. An non-critical extension
144implies that if a validator cannot recognize or cannot parse the extension, the
145validator may ignore the extension.
146
147The TLV-TYPE code range [256, 512) is reserved for extensions. The last bit of a
148TLV-TYPE code indicates whether the extension is critical or not: ``1`` for critical
149while ``0`` for non-critical. If an extension could be either critical or
150non-critical, the extension should be allocated with two TLV-TYPE codes which only
151differ at the last bit. For example, TLV-TYPE codes 256 and 257 are allocated to the
152``StatusChecking`` extension, 256 for critical StatusChecking while 257 for
153non-critical StatusChecking.
154
155
156Proposed Extensions
157-------------------
158
159We list the proposed extensions here:
160
161+---------------------------------------------+-------------------+----------------+
162| TLV-TYPE | Assigned code | Assigned code |
163| | (decimal) | (hexadecimal) |
164+=============================================+===================+================+
165| StatusChecking (Non-critical) | 256 | 0x0100 |
166+---------------------------------------------+-------------------+----------------+
167| StatusChecking (Critical) | 257 | 0x0101 |
168+---------------------------------------------+-------------------+----------------+
169| AdditionalDescription (Non-critical) | 258 | 0x0102 |
170+---------------------------------------------+-------------------+----------------+
171| MultipleSignature (Critical) | 259 | 0x0103 |
172+---------------------------------------------+-------------------+----------------+
173
174.. note::
175 TLV-TYPE code that falls into [253, 65536) is encoded in
176 `3-byte <http://named-data.net/doc/ndn-tlv/tlv.html#variable-size-encoding-for-type-t-and-length-l>`__
177
178Status Checking
179~~~~~~~~~~~~~~~
180
181TBD
182
183Multiple Signature
184~~~~~~~~~~~~~~~~~~
185
186TBD
187
188AdditionalDescription
189~~~~~~~~~~~~~~~~~~~~~
190
191``AdditionalDescription`` is a non-critical extension that provides additional
192information about the certificate. The information is expressed as a set of
193key-value pairs. Both key and value are UTF-8 strings, e.g.,
194``("Organization", "UCLA")``. The issuer of a certificate can specify arbitrary
195key-value pair to provide additional description about the certificate.
196
197::
198
199 AdditionalDescription ::= ADDITIONAL-DESCRIPTION-TYPE TLV-LENGTH
200 DescriptionEntry+
201
202 DescriptionEntry ::= DESCRIPTION-ENTRY-TYPE TLV-LENGTH
203 DescriptionKey
204 DescriptionValue
205
206 DescriptionKey ::= DESCRIPTION-KEY-TYPE TLV-LENGTH
207 BYTE+
208
209 DescriptionValue ::= DESCRIPTION-VALUE-TYPE TLV-LENGTH
210 BYTE+
211
212+---------------------------------------------+-------------------+----------------+
213| TLV-TYPE | Assigned code | Assigned code |
214| | (decimal) | (hexadecimal) |
215+=============================================+===================+================+
216| DescriptionEntry | 512 | 0x0200 |
217+---------------------------------------------+-------------------+----------------+
218| DescriptionKey | 513 | 0x0201 |
219+---------------------------------------------+-------------------+----------------+
220| DescriptionValue | 514 | 0x0202 |
221+---------------------------------------------+-------------------+----------------+