blob: f1ec424252b69f66ddc08475c0ed13acdc763057 [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
Junxiao Shi9a04dda2019-07-02 15:18:20 +000050 CertificateV2 = DATA-TYPE TLV-LENGTH
51 Name ; /<NameSpace>/KEY/[KeyId]/[IssuerId]/[Version]
52 MetaInfo ; ContentType = KEY, FreshnessPeriod required
53 Content ; X509PublicKey
54 CertificateV2SignatureInfo
55 SignatureValue
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070056
Junxiao Shi9a04dda2019-07-02 15:18:20 +000057 CertificateV2SignatureInfo = SIGNATURE-INFO-TYPE TLV-LENGTH
58 SignatureType
59 KeyLocator
60 ValidityPeriod
61 *CertificateV2Extension
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070062
63
Yingdi Yufba8a632015-06-08 22:25:54 -070064Name
65----
66
Yingdi Yu7f8e8fe2015-11-04 12:24:11 -080067The name of a certificate consists of five parts as shown below:
Yingdi Yufba8a632015-06-08 22:25:54 -070068
69::
70
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070071 /<SubjectName>/KEY/[KeyId]/[IssuerId]/[Version]
Yingdi Yufba8a632015-06-08 22:25:54 -070072
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070073A certificate name starts with the subject to which a public key is bound. The following parts
74include the keyword ``KEY`` component, KeyId, IssuerId, and version components.
75
76``KeyId`` is an opaque name component to identify an instance of the public key for the
77certificate namespace. The value of `Key ID` is controlled by the namespace owner and can be
78an 8-byte random number, SHA-256 digest of the public key, timestamp, or a simple numerical
79identifier.
80
81``Issuer Id`` is an opaque name component to identify issuer of the certificate. The value is
82controlled by the certificate issuer and, similar to KeyId, can be an 8-byte random number,
83SHA-256 digest of the issuer's public key, or a simple numerical identifier.
84
85
Yingdi Yu7f8e8fe2015-11-04 12:24:11 -080086For example,
Yingdi Yufba8a632015-06-08 22:25:54 -070087
88::
89
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070090 /edu/ucla/cs/yingdi/KEY/%03%CD...%F1/%9F%D3...%B7/%FD%d2...%8E
91 \_________________/ \___________/ \___________/\___________/
92 Certificate Namespace Key Id Issuer Id Version
93 (Identity)
Yingdi Yufba8a632015-06-08 22:25:54 -070094
95
96MetaInfo
97--------
98
99The ``ContentType`` of certificate is set to ``KEY`` (2).
100
101The ``FreshnessPeriod`` of certificate must be explicitly specified. The
102recommended value is 1 hour (3,600,000 milliseconds).
103
104Content
105-------
106
107By default, the content of a certificate is the public key encoded in
108`X509PublicKey <https://tools.ietf.org/html/rfc5280#section-4.1.2.7>`__ format.
109
110SignatureInfo
111-------------
112
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700113The SignatureInfo block of a certificate is required to include the ``ValidityPeriod`` field.
114``ValidityPeriod`` includes two sub TLV fields: ``NotBefore`` and ``NotAfter``, which carry two
115UTC timestamps in ISO 8601 compact format (``yyyymmddTHHMMSS``, e.g., "20020131T235959").
116``NotBefore`` indicates when the certificate takes effect while ``NotAfter`` indicates when the
117certificate expires.
Yingdi Yufba8a632015-06-08 22:25:54 -0700118
119.. note::
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700120 Using ISO style string is the convention of specifying the validity period of certificate,
121 which has been adopted by many certificate systems, such as X.509, PGP, and DNSSEC.
Yingdi Yufba8a632015-06-08 22:25:54 -0700122
123::
124
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000125 ValidityPeriod = VALIDITY-PERIOD-TYPE TLV-LENGTH
126 NotBefore
127 NotAfter
Yingdi Yufba8a632015-06-08 22:25:54 -0700128
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000129 NotBefore = NOT-BEFORE-TYPE TLV-LENGTH 8DIGIT "T" 6DIGIT
Yingdi Yufba8a632015-06-08 22:25:54 -0700130
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000131 NotAfter = NOT-AFTER-TYPE TLV-LENGTH 8DIGIT "T" 6DIGIT
Yingdi Yufba8a632015-06-08 22:25:54 -0700132
133For each TLV, the TLV-TYPE codes are assigned as below:
134
135+---------------------------------------------+-------------------+----------------+
136| TLV-TYPE | Assigned code | Assigned code |
137| | (decimal) | (hexadecimal) |
138+=============================================+===================+================+
139| ValidityPeriod | 253 | 0xFD |
140+---------------------------------------------+-------------------+----------------+
141| NotBefore | 254 | 0xFE |
142+---------------------------------------------+-------------------+----------------+
143| NotAfter | 255 | 0xFF |
144+---------------------------------------------+-------------------+----------------+
145
Yingdi Yufba8a632015-06-08 22:25:54 -0700146Extensions
147~~~~~~~~~~
148
149A certificate may optionally carry some extensions in SignatureInfo. An extension
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700150could be either critical or non-critical depends on the TLV-TYPE code convention. A
151critical extension implies that if a validator cannot recognize or parse the
152extension, the validator must reject the certificate. A non-critical extension
Yingdi Yufba8a632015-06-08 22:25:54 -0700153implies that if a validator cannot recognize or cannot parse the extension, the
154validator may ignore the extension.
155
156The TLV-TYPE code range [256, 512) is reserved for extensions. The last bit of a
157TLV-TYPE code indicates whether the extension is critical or not: ``1`` for critical
158while ``0`` for non-critical. If an extension could be either critical or
159non-critical, the extension should be allocated with two TLV-TYPE codes which only
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700160differ at the last bit.
Yingdi Yufba8a632015-06-08 22:25:54 -0700161
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700162Extensions
163----------
Yingdi Yufba8a632015-06-08 22:25:54 -0700164
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700165We list currently defined extensions:
Yingdi Yufba8a632015-06-08 22:25:54 -0700166
167+---------------------------------------------+-------------------+----------------+
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000168| TLV-TYPE | Assigned number | Assigned number|
Yingdi Yufba8a632015-06-08 22:25:54 -0700169| | (decimal) | (hexadecimal) |
170+=============================================+===================+================+
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700171| AdditionalDescription (non-critical) | 258 | 0x0102 |
Yingdi Yufba8a632015-06-08 22:25:54 -0700172+---------------------------------------------+-------------------+----------------+
Yingdi Yufba8a632015-06-08 22:25:54 -0700173
174AdditionalDescription
175~~~~~~~~~~~~~~~~~~~~~
176
177``AdditionalDescription`` is a non-critical extension that provides additional
178information about the certificate. The information is expressed as a set of
179key-value pairs. Both key and value are UTF-8 strings, e.g.,
180``("Organization", "UCLA")``. The issuer of a certificate can specify arbitrary
181key-value pair to provide additional description about the certificate.
182
183::
184
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000185 CertificateV2Extension = AdditionalDescription
Yingdi Yufba8a632015-06-08 22:25:54 -0700186
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000187 AdditionalDescription = ADDITIONAL-DESCRIPTION-TYPE TLV-LENGTH
188 1*DescriptionEntry
Yingdi Yufba8a632015-06-08 22:25:54 -0700189
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000190 DescriptionEntry = DESCRIPTION-ENTRY-TYPE TLV-LENGTH
191 DescriptionKey
192 DescriptionValue
Yingdi Yufba8a632015-06-08 22:25:54 -0700193
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000194 DescriptionKey = DESCRIPTION-KEY-TYPE TLV-LENGTH 1*OCTET
195
196 DescriptionValue = DESCRIPTION-VALUE-TYPE TLV-LENGTH 1*OCTET
Yingdi Yufba8a632015-06-08 22:25:54 -0700197
198+---------------------------------------------+-------------------+----------------+
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000199| TLV-TYPE | Assigned number | Assigned number|
Yingdi Yufba8a632015-06-08 22:25:54 -0700200| | (decimal) | (hexadecimal) |
201+=============================================+===================+================+
202| DescriptionEntry | 512 | 0x0200 |
203+---------------------------------------------+-------------------+----------------+
204| DescriptionKey | 513 | 0x0201 |
205+---------------------------------------------+-------------------+----------------+
206| DescriptionValue | 514 | 0x0202 |
207+---------------------------------------------+-------------------+----------------+