blob: 9db67b3a3e3f710eb40999f264852bba353692c0 [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
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070014naming and structure of the NDN certificates and is complementary to NDN packet
Yingdi Yufba8a632015-06-08 22:25:54 -070015specification.
16
17::
18
19 Overview of NDN certificate format
20 +--------------------------+
21 | Name |
22 +--------------------------+
23 | MetaInfo |
24 |+------------------------+|
25 || ContentType: KEY(2) ||
26 |+------------------------+|
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070027 |+------------------------+|
28 || FreshnessPeriod: >~ 1h ||
29 |+------------------------+|
Yingdi Yufba8a632015-06-08 22:25:54 -070030 +--------------------------+
31 | Content |
32 |+------------------------+|
33 || Public Key ||
34 |+------------------------+|
35 +--------------------------+
36 | SignatureInfo |
37 |+------------------------+|
38 || SignatureType: ... ||
39 || KeyLocator: ... ||
40 || ValidityPeriod: ... ||
41 || ... ||
42 |+------------------------+|
43 +--------------------------+
44 | SignatureValue |
45 +--------------------------+
46
47
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070048 CertificateV2 ::= DATA-TLV TLV-LENGTH
49 Name (= /<NameSpace>/KEY/[KeyId]/[IssuerId]/[Version])
50 MetaInfo (.ContentType = KEY,
51 .FreshnessPeriod >~ 1h))
52 Content (= X509PublicKeyContent)
53 SignatureInfo (= CertificateV2SignatureInfo)
54 SignatureValue
55
56 X509PublicKeyContent ::= CONTENT-TLV TLV-LENGTH
57 BYTE+ (= public key bits in PKCS#8 format)
58
59 CertificateV2SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
60 SignatureType
61 KeyLocator
62 ValidityPeriod
63 ... optional critical or non-critical extension blocks ...
64
65
Yingdi Yufba8a632015-06-08 22:25:54 -070066Name
67----
68
Yingdi Yu7f8e8fe2015-11-04 12:24:11 -080069The name of a certificate consists of five parts as shown below:
Yingdi Yufba8a632015-06-08 22:25:54 -070070
71::
72
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070073 /<SubjectName>/KEY/[KeyId]/[IssuerId]/[Version]
Yingdi Yufba8a632015-06-08 22:25:54 -070074
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070075A certificate name starts with the subject to which a public key is bound. The following parts
76include the keyword ``KEY`` component, KeyId, IssuerId, and version components.
77
78``KeyId`` is an opaque name component to identify an instance of the public key for the
79certificate namespace. The value of `Key ID` is controlled by the namespace owner and can be
80an 8-byte random number, SHA-256 digest of the public key, timestamp, or a simple numerical
81identifier.
82
83``Issuer Id`` is an opaque name component to identify issuer of the certificate. The value is
84controlled by the certificate issuer and, similar to KeyId, can be an 8-byte random number,
85SHA-256 digest of the issuer's public key, or a simple numerical identifier.
86
87
Yingdi Yu7f8e8fe2015-11-04 12:24:11 -080088For example,
Yingdi Yufba8a632015-06-08 22:25:54 -070089
90::
91
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070092 /edu/ucla/cs/yingdi/KEY/%03%CD...%F1/%9F%D3...%B7/%FD%d2...%8E
93 \_________________/ \___________/ \___________/\___________/
94 Certificate Namespace Key Id Issuer Id Version
95 (Identity)
Yingdi Yufba8a632015-06-08 22:25:54 -070096
97
98MetaInfo
99--------
100
101The ``ContentType`` of certificate is set to ``KEY`` (2).
102
103The ``FreshnessPeriod`` of certificate must be explicitly specified. The
104recommended value is 1 hour (3,600,000 milliseconds).
105
106Content
107-------
108
109By default, the content of a certificate is the public key encoded in
110`X509PublicKey <https://tools.ietf.org/html/rfc5280#section-4.1.2.7>`__ format.
111
112SignatureInfo
113-------------
114
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700115The SignatureInfo block of a certificate is required to include the ``ValidityPeriod`` field.
116``ValidityPeriod`` includes two sub TLV fields: ``NotBefore`` and ``NotAfter``, which carry two
117UTC timestamps in ISO 8601 compact format (``yyyymmddTHHMMSS``, e.g., "20020131T235959").
118``NotBefore`` indicates when the certificate takes effect while ``NotAfter`` indicates when the
119certificate expires.
Yingdi Yufba8a632015-06-08 22:25:54 -0700120
121.. note::
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700122 Using ISO style string is the convention of specifying the validity period of certificate,
123 which has been adopted by many certificate systems, such as X.509, PGP, and DNSSEC.
Yingdi Yufba8a632015-06-08 22:25:54 -0700124
125::
126
127 ValidityPeriod ::= VALIDITY-PERIOD-TYPE TLV-LENGTH
128 NotBefore
129 NotAfter
130
131 NotBefore ::= NOT-BEFORE-TYPE TLV-LENGTH
132 BYTE{15}
133
134 NotAfter ::= NOT-AFTER-TYPE TLV-LENGTH
135 BYTE{15}
136
137For each TLV, the TLV-TYPE codes are assigned as below:
138
139+---------------------------------------------+-------------------+----------------+
140| TLV-TYPE | Assigned code | Assigned code |
141| | (decimal) | (hexadecimal) |
142+=============================================+===================+================+
143| ValidityPeriod | 253 | 0xFD |
144+---------------------------------------------+-------------------+----------------+
145| NotBefore | 254 | 0xFE |
146+---------------------------------------------+-------------------+----------------+
147| NotAfter | 255 | 0xFF |
148+---------------------------------------------+-------------------+----------------+
149
Yingdi Yufba8a632015-06-08 22:25:54 -0700150Extensions
151~~~~~~~~~~
152
153A certificate may optionally carry some extensions in SignatureInfo. An extension
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700154could be either critical or non-critical depends on the TLV-TYPE code convention. A
155critical extension implies that if a validator cannot recognize or parse the
156extension, the validator must reject the certificate. A non-critical extension
Yingdi Yufba8a632015-06-08 22:25:54 -0700157implies that if a validator cannot recognize or cannot parse the extension, the
158validator may ignore the extension.
159
160The TLV-TYPE code range [256, 512) is reserved for extensions. The last bit of a
161TLV-TYPE code indicates whether the extension is critical or not: ``1`` for critical
162while ``0`` for non-critical. If an extension could be either critical or
163non-critical, the extension should be allocated with two TLV-TYPE codes which only
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700164differ at the last bit.
Yingdi Yufba8a632015-06-08 22:25:54 -0700165
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700166Extensions
167----------
Yingdi Yufba8a632015-06-08 22:25:54 -0700168
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700169We list currently defined extensions:
Yingdi Yufba8a632015-06-08 22:25:54 -0700170
171+---------------------------------------------+-------------------+----------------+
172| TLV-TYPE | Assigned code | Assigned code |
173| | (decimal) | (hexadecimal) |
174+=============================================+===================+================+
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700175| AdditionalDescription (non-critical) | 258 | 0x0102 |
Yingdi Yufba8a632015-06-08 22:25:54 -0700176+---------------------------------------------+-------------------+----------------+
Yingdi Yufba8a632015-06-08 22:25:54 -0700177
178AdditionalDescription
179~~~~~~~~~~~~~~~~~~~~~
180
181``AdditionalDescription`` is a non-critical extension that provides additional
182information about the certificate. The information is expressed as a set of
183key-value pairs. Both key and value are UTF-8 strings, e.g.,
184``("Organization", "UCLA")``. The issuer of a certificate can specify arbitrary
185key-value pair to provide additional description about the certificate.
186
187::
188
189 AdditionalDescription ::= ADDITIONAL-DESCRIPTION-TYPE TLV-LENGTH
190 DescriptionEntry+
191
192 DescriptionEntry ::= DESCRIPTION-ENTRY-TYPE TLV-LENGTH
193 DescriptionKey
194 DescriptionValue
195
196 DescriptionKey ::= DESCRIPTION-KEY-TYPE TLV-LENGTH
197 BYTE+
198
199 DescriptionValue ::= DESCRIPTION-VALUE-TYPE TLV-LENGTH
200 BYTE+
201
202+---------------------------------------------+-------------------+----------------+
203| TLV-TYPE | Assigned code | Assigned code |
204| | (decimal) | (hexadecimal) |
205+=============================================+===================+================+
206| DescriptionEntry | 512 | 0x0200 |
207+---------------------------------------------+-------------------+----------------+
208| DescriptionKey | 513 | 0x0201 |
209+---------------------------------------------+-------------------+----------------+
210| DescriptionValue | 514 | 0x0202 |
211+---------------------------------------------+-------------------+----------------+