blob: 9e811b9e50b83f7d004f0459545784fd710691e9 [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
Yingdi Yufba8a632015-06-08 22:25:54 -07006Since 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
Davide Pesavento933a5672020-07-03 22:32:43 -040047.. code-block:: abnf
Yingdi Yufba8a632015-06-08 22:25:54 -070048
Davide Pesavento933a5672020-07-03 22:32:43 -040049 CertificateV2 = DATA-TYPE TLV-LENGTH
50 Name ; /<NameSpace>/KEY/[KeyId]/[IssuerId]/[Version]
51 MetaInfo ; ContentType == KEY, FreshnessPeriod required
52 Content ; X509PublicKey
53 CertificateV2SignatureInfo
54 SignatureValue
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070055
Davide Pesavento933a5672020-07-03 22:32:43 -040056 CertificateV2SignatureInfo = SIGNATURE-INFO-TYPE TLV-LENGTH
57 SignatureType
58 KeyLocator
59 ValidityPeriod
60 *CertificateV2Extension
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070061
62
Yingdi Yufba8a632015-06-08 22:25:54 -070063Name
64----
65
Davide Pesavento933a5672020-07-03 22:32:43 -040066The name of a certificate consists of five parts as shown below::
Yingdi Yufba8a632015-06-08 22:25:54 -070067
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070068 /<SubjectName>/KEY/[KeyId]/[IssuerId]/[Version]
Yingdi Yufba8a632015-06-08 22:25:54 -070069
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070070A certificate name starts with the subject to which a public key is bound. The following parts
71include the keyword ``KEY`` component, KeyId, IssuerId, and version components.
72
73``KeyId`` is an opaque name component to identify an instance of the public key for the
74certificate namespace. The value of `Key ID` is controlled by the namespace owner and can be
75an 8-byte random number, SHA-256 digest of the public key, timestamp, or a simple numerical
76identifier.
77
78``Issuer Id`` is an opaque name component to identify issuer of the certificate. The value is
79controlled by the certificate issuer and, similar to KeyId, can be an 8-byte random number,
80SHA-256 digest of the issuer's public key, or a simple numerical identifier.
81
Davide Pesavento933a5672020-07-03 22:32:43 -040082For example::
Yingdi Yufba8a632015-06-08 22:25:54 -070083
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -070084 /edu/ucla/cs/yingdi/KEY/%03%CD...%F1/%9F%D3...%B7/%FD%d2...%8E
85 \_________________/ \___________/ \___________/\___________/
86 Certificate Namespace Key Id Issuer Id Version
87 (Identity)
Yingdi Yufba8a632015-06-08 22:25:54 -070088
Yingdi Yufba8a632015-06-08 22:25:54 -070089MetaInfo
90--------
91
92The ``ContentType`` of certificate is set to ``KEY`` (2).
93
94The ``FreshnessPeriod`` of certificate must be explicitly specified. The
95recommended value is 1 hour (3,600,000 milliseconds).
96
97Content
98-------
99
100By default, the content of a certificate is the public key encoded in
101`X509PublicKey <https://tools.ietf.org/html/rfc5280#section-4.1.2.7>`__ format.
102
103SignatureInfo
104-------------
105
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700106The SignatureInfo block of a certificate is required to include the ``ValidityPeriod`` field.
107``ValidityPeriod`` includes two sub TLV fields: ``NotBefore`` and ``NotAfter``, which carry two
108UTC timestamps in ISO 8601 compact format (``yyyymmddTHHMMSS``, e.g., "20020131T235959").
109``NotBefore`` indicates when the certificate takes effect while ``NotAfter`` indicates when the
110certificate expires.
Yingdi Yufba8a632015-06-08 22:25:54 -0700111
112.. note::
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700113 Using ISO style string is the convention of specifying the validity period of certificate,
114 which has been adopted by many certificate systems, such as X.509, PGP, and DNSSEC.
Yingdi Yufba8a632015-06-08 22:25:54 -0700115
Davide Pesavento933a5672020-07-03 22:32:43 -0400116.. code-block:: abnf
Yingdi Yufba8a632015-06-08 22:25:54 -0700117
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000118 ValidityPeriod = VALIDITY-PERIOD-TYPE TLV-LENGTH
119 NotBefore
120 NotAfter
Yingdi Yufba8a632015-06-08 22:25:54 -0700121
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000122 NotBefore = NOT-BEFORE-TYPE TLV-LENGTH 8DIGIT "T" 6DIGIT
Yingdi Yufba8a632015-06-08 22:25:54 -0700123
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000124 NotAfter = NOT-AFTER-TYPE TLV-LENGTH 8DIGIT "T" 6DIGIT
Yingdi Yufba8a632015-06-08 22:25:54 -0700125
126For each TLV, the TLV-TYPE codes are assigned as below:
127
128+---------------------------------------------+-------------------+----------------+
129| TLV-TYPE | Assigned code | Assigned code |
130| | (decimal) | (hexadecimal) |
131+=============================================+===================+================+
132| ValidityPeriod | 253 | 0xFD |
133+---------------------------------------------+-------------------+----------------+
134| NotBefore | 254 | 0xFE |
135+---------------------------------------------+-------------------+----------------+
136| NotAfter | 255 | 0xFF |
137+---------------------------------------------+-------------------+----------------+
138
Yingdi Yufba8a632015-06-08 22:25:54 -0700139Extensions
140~~~~~~~~~~
141
142A certificate may optionally carry some extensions in SignatureInfo. An extension
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700143could be either critical or non-critical depends on the TLV-TYPE code convention. A
144critical extension implies that if a validator cannot recognize or parse the
145extension, the validator must reject the certificate. A non-critical extension
Yingdi Yufba8a632015-06-08 22:25:54 -0700146implies that if a validator cannot recognize or cannot parse the extension, the
147validator may ignore the extension.
148
149The TLV-TYPE code range [256, 512) is reserved for extensions. The last bit of a
150TLV-TYPE code indicates whether the extension is critical or not: ``1`` for critical
151while ``0`` for non-critical. If an extension could be either critical or
152non-critical, the extension should be allocated with two TLV-TYPE codes which only
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700153differ at the last bit.
Yingdi Yufba8a632015-06-08 22:25:54 -0700154
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700155Extensions
156----------
Yingdi Yufba8a632015-06-08 22:25:54 -0700157
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700158We list currently defined extensions:
Yingdi Yufba8a632015-06-08 22:25:54 -0700159
160+---------------------------------------------+-------------------+----------------+
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000161| TLV-TYPE | Assigned number | Assigned number|
Yingdi Yufba8a632015-06-08 22:25:54 -0700162| | (decimal) | (hexadecimal) |
163+=============================================+===================+================+
Zhiyi Zhangf4bb5c72015-08-19 19:02:51 -0700164| AdditionalDescription (non-critical) | 258 | 0x0102 |
Yingdi Yufba8a632015-06-08 22:25:54 -0700165+---------------------------------------------+-------------------+----------------+
Yingdi Yufba8a632015-06-08 22:25:54 -0700166
167AdditionalDescription
168~~~~~~~~~~~~~~~~~~~~~
169
170``AdditionalDescription`` is a non-critical extension that provides additional
171information about the certificate. The information is expressed as a set of
172key-value pairs. Both key and value are UTF-8 strings, e.g.,
173``("Organization", "UCLA")``. The issuer of a certificate can specify arbitrary
174key-value pair to provide additional description about the certificate.
175
Davide Pesavento933a5672020-07-03 22:32:43 -0400176.. code-block:: abnf
Yingdi Yufba8a632015-06-08 22:25:54 -0700177
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000178 CertificateV2Extension = AdditionalDescription
Yingdi Yufba8a632015-06-08 22:25:54 -0700179
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000180 AdditionalDescription = ADDITIONAL-DESCRIPTION-TYPE TLV-LENGTH
181 1*DescriptionEntry
Yingdi Yufba8a632015-06-08 22:25:54 -0700182
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000183 DescriptionEntry = DESCRIPTION-ENTRY-TYPE TLV-LENGTH
184 DescriptionKey
185 DescriptionValue
Yingdi Yufba8a632015-06-08 22:25:54 -0700186
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000187 DescriptionKey = DESCRIPTION-KEY-TYPE TLV-LENGTH 1*OCTET
188
189 DescriptionValue = DESCRIPTION-VALUE-TYPE TLV-LENGTH 1*OCTET
Yingdi Yufba8a632015-06-08 22:25:54 -0700190
191+---------------------------------------------+-------------------+----------------+
Junxiao Shi9a04dda2019-07-02 15:18:20 +0000192| TLV-TYPE | Assigned number | Assigned number|
Yingdi Yufba8a632015-06-08 22:25:54 -0700193| | (decimal) | (hexadecimal) |
194+=============================================+===================+================+
195| DescriptionEntry | 512 | 0x0200 |
196+---------------------------------------------+-------------------+----------------+
197| DescriptionKey | 513 | 0x0201 |
198+---------------------------------------------+-------------------+----------------+
199| DescriptionValue | 514 | 0x0202 |
200+---------------------------------------------+-------------------+----------------+