blob: d0099856bcde64b7198e6bf850c119af2cbce052 [file] [log] [blame]
Alexander Afanasyevaa8b3782017-01-19 20:04:31 -08001.. _NDN Certificate Format Version 2.0:
2
Yingdi Yufba8a632015-06-08 22:25:54 -07003NDN Certificate Format Version 2.0
4==================================
5
6.. contents::
7
8Since signature verification is a common operation in NDN applications, it is
9important to define a common certificate format to standardize the public key
10authentication procedure. As every NDN data packet is signed, a data packet
11that carries a public key as content is conceptually a certificate. However,
12the specification of a data packet is not sufficient to be the specification of
13a common certificate format, as it requires additional components. For example,
14a certificate may follow a specific naming convention and may need to include
15validity period, revocation information, etc. This specification defines
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070016naming and structure of the NDN certificates and is complementary to NDN packet
Yingdi Yufba8a632015-06-08 22:25:54 -070017specification.
18
19::
20
21 Overview of NDN certificate format
22 +--------------------------+
23 | Name |
24 +--------------------------+
25 | MetaInfo |
26 |+------------------------+|
27 || ContentType: KEY(2) ||
28 |+------------------------+|
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070029 |+------------------------+|
30 || FreshnessPeriod: >~ 1h ||
31 |+------------------------+|
Yingdi Yufba8a632015-06-08 22:25:54 -070032 +--------------------------+
33 | Content |
34 |+------------------------+|
35 || Public Key ||
36 |+------------------------+|
37 +--------------------------+
38 | SignatureInfo |
39 |+------------------------+|
40 || SignatureType: ... ||
41 || KeyLocator: ... ||
42 || ValidityPeriod: ... ||
43 || ... ||
44 |+------------------------+|
45 +--------------------------+
46 | SignatureValue |
47 +--------------------------+
48
49
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070050 CertificateV2 ::= DATA-TLV TLV-LENGTH
51 Name (= /<NameSpace>/KEY/[KeyId]/[IssuerId]/[Version])
52 MetaInfo (.ContentType = KEY,
53 .FreshnessPeriod >~ 1h))
54 Content (= X509PublicKeyContent)
55 SignatureInfo (= CertificateV2SignatureInfo)
56 SignatureValue
57
58 X509PublicKeyContent ::= CONTENT-TLV TLV-LENGTH
59 BYTE+ (= public key bits in PKCS#8 format)
60
61 CertificateV2SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
62 SignatureType
63 KeyLocator
64 ValidityPeriod
65 ... optional critical or non-critical extension blocks ...
66
67
Yingdi Yufba8a632015-06-08 22:25:54 -070068Name
69----
70
Yingdi Yu7f8e8fe2015-11-04 12:24:11 -080071The name of a certificate consists of five parts as shown below:
Yingdi Yufba8a632015-06-08 22:25:54 -070072
73::
74
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070075 /<SubjectName>/KEY/[KeyId]/[IssuerId]/[Version]
Yingdi Yufba8a632015-06-08 22:25:54 -070076
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070077A certificate name starts with the subject to which a public key is bound. The following parts
78include the keyword ``KEY`` component, KeyId, IssuerId, and version components.
79
80``KeyId`` is an opaque name component to identify an instance of the public key for the
81certificate namespace. The value of `Key ID` is controlled by the namespace owner and can be
82an 8-byte random number, SHA-256 digest of the public key, timestamp, or a simple numerical
83identifier.
84
85``Issuer Id`` is an opaque name component to identify issuer of the certificate. The value is
86controlled by the certificate issuer and, similar to KeyId, can be an 8-byte random number,
87SHA-256 digest of the issuer's public key, or a simple numerical identifier.
88
89
Yingdi Yu7f8e8fe2015-11-04 12:24:11 -080090For example,
Yingdi Yufba8a632015-06-08 22:25:54 -070091
92::
93
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070094 /edu/ucla/cs/yingdi/KEY/%03%CD...%F1/%9F%D3...%B7/%FD%d2...%8E
95 \_________________/ \___________/ \___________/\___________/
96 Certificate Namespace Key Id Issuer Id Version
97 (Identity)
Yingdi Yufba8a632015-06-08 22:25:54 -070098
99
100MetaInfo
101--------
102
103The ``ContentType`` of certificate is set to ``KEY`` (2).
104
105The ``FreshnessPeriod`` of certificate must be explicitly specified. The
106recommended value is 1 hour (3,600,000 milliseconds).
107
108Content
109-------
110
111By default, the content of a certificate is the public key encoded in
112`X509PublicKey <https://tools.ietf.org/html/rfc5280#section-4.1.2.7>`__ format.
113
114SignatureInfo
115-------------
116
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700117The SignatureInfo block of a certificate is required to include the ``ValidityPeriod`` field.
118``ValidityPeriod`` includes two sub TLV fields: ``NotBefore`` and ``NotAfter``, which carry two
119UTC timestamps in ISO 8601 compact format (``yyyymmddTHHMMSS``, e.g., "20020131T235959").
120``NotBefore`` indicates when the certificate takes effect while ``NotAfter`` indicates when the
121certificate expires.
Yingdi Yufba8a632015-06-08 22:25:54 -0700122
123.. note::
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700124 Using ISO style string is the convention of specifying the validity period of certificate,
125 which has been adopted by many certificate systems, such as X.509, PGP, and DNSSEC.
Yingdi Yufba8a632015-06-08 22:25:54 -0700126
127::
128
129 ValidityPeriod ::= VALIDITY-PERIOD-TYPE TLV-LENGTH
130 NotBefore
131 NotAfter
132
133 NotBefore ::= NOT-BEFORE-TYPE TLV-LENGTH
134 BYTE{15}
135
136 NotAfter ::= NOT-AFTER-TYPE TLV-LENGTH
137 BYTE{15}
138
139For each TLV, the TLV-TYPE codes are assigned as below:
140
141+---------------------------------------------+-------------------+----------------+
142| TLV-TYPE | Assigned code | Assigned code |
143| | (decimal) | (hexadecimal) |
144+=============================================+===================+================+
145| ValidityPeriod | 253 | 0xFD |
146+---------------------------------------------+-------------------+----------------+
147| NotBefore | 254 | 0xFE |
148+---------------------------------------------+-------------------+----------------+
149| NotAfter | 255 | 0xFF |
150+---------------------------------------------+-------------------+----------------+
151
Yingdi Yufba8a632015-06-08 22:25:54 -0700152Extensions
153~~~~~~~~~~
154
155A certificate may optionally carry some extensions in SignatureInfo. An extension
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700156could be either critical or non-critical depends on the TLV-TYPE code convention. A
157critical extension implies that if a validator cannot recognize or parse the
158extension, the validator must reject the certificate. A non-critical extension
Yingdi Yufba8a632015-06-08 22:25:54 -0700159implies that if a validator cannot recognize or cannot parse the extension, the
160validator may ignore the extension.
161
162The TLV-TYPE code range [256, 512) is reserved for extensions. The last bit of a
163TLV-TYPE code indicates whether the extension is critical or not: ``1`` for critical
164while ``0`` for non-critical. If an extension could be either critical or
165non-critical, the extension should be allocated with two TLV-TYPE codes which only
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700166differ at the last bit.
Yingdi Yufba8a632015-06-08 22:25:54 -0700167
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700168Extensions
169----------
Yingdi Yufba8a632015-06-08 22:25:54 -0700170
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700171We list currently defined extensions:
Yingdi Yufba8a632015-06-08 22:25:54 -0700172
173+---------------------------------------------+-------------------+----------------+
174| TLV-TYPE | Assigned code | Assigned code |
175| | (decimal) | (hexadecimal) |
176+=============================================+===================+================+
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700177| AdditionalDescription (non-critical) | 258 | 0x0102 |
Yingdi Yufba8a632015-06-08 22:25:54 -0700178+---------------------------------------------+-------------------+----------------+
Yingdi Yufba8a632015-06-08 22:25:54 -0700179
180AdditionalDescription
181~~~~~~~~~~~~~~~~~~~~~
182
183``AdditionalDescription`` is a non-critical extension that provides additional
184information about the certificate. The information is expressed as a set of
185key-value pairs. Both key and value are UTF-8 strings, e.g.,
186``("Organization", "UCLA")``. The issuer of a certificate can specify arbitrary
187key-value pair to provide additional description about the certificate.
188
189::
190
191 AdditionalDescription ::= ADDITIONAL-DESCRIPTION-TYPE TLV-LENGTH
192 DescriptionEntry+
193
194 DescriptionEntry ::= DESCRIPTION-ENTRY-TYPE TLV-LENGTH
195 DescriptionKey
196 DescriptionValue
197
198 DescriptionKey ::= DESCRIPTION-KEY-TYPE TLV-LENGTH
199 BYTE+
200
201 DescriptionValue ::= DESCRIPTION-VALUE-TYPE TLV-LENGTH
202 BYTE+
203
204+---------------------------------------------+-------------------+----------------+
205| TLV-TYPE | Assigned code | Assigned code |
206| | (decimal) | (hexadecimal) |
207+=============================================+===================+================+
208| DescriptionEntry | 512 | 0x0200 |
209+---------------------------------------------+-------------------+----------------+
210| DescriptionKey | 513 | 0x0201 |
211+---------------------------------------------+-------------------+----------------+
212| DescriptionValue | 514 | 0x0202 |
213+---------------------------------------------+-------------------+----------------+