blob: 206501d8ccd02a5f52dd1d961c95393fe02973ce [file] [log] [blame]
Davide Pesavento3a74e132022-11-26 22:10:21 -05001.. _Certificate:
2
3Certificate
4===========
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 alone is not sufficient to serve as the
11specification of a common NDN certificate format, because additional provisions
12are required for the latter. For example, a certificate follows a specific
13naming scheme and may need to include validity period, revocation information,
14etc. This section defines the naming and structure of NDN certificates.
15
16.. code-block:: text
17
18 Structure of an NDN certificate
19 +--------------------------+
20 | Name |
21 +--------------------------+
22 | MetaInfo |
23 |+------------------------+|
24 || ContentType: KEY(2) ||
25 |+------------------------+|
26 |+------------------------+|
27 || FreshnessPeriod: ~1h ||
28 |+------------------------+|
29 +--------------------------+
30 | Content |
31 |+------------------------+|
32 || Public Key ||
33 |+------------------------+|
34 +--------------------------+
35 | SignatureInfo |
36 |+------------------------+|
37 || SignatureType: ... ||
38 || KeyLocator: ... ||
39 || ValidityPeriod: ... ||
40 || ... ||
41 |+------------------------+|
42 +--------------------------+
43 | SignatureValue |
44 +--------------------------+
45
46::
47
48 Certificate = DATA-TYPE TLV-LENGTH
49 Name ; /<IdentityName>/KEY/<KeyId>/<IssuerId>/<Version>
50 MetaInfo ; ContentType == KEY, FreshnessPeriod required
51 CertificateContent
52 CertificateSignatureInfo
53 SignatureValue
54
55 CertificateContent = CONTENT-TYPE TLV-LENGTH SubjectPublicKeyInfo
56
57 CertificateSignatureInfo = SIGNATURE-INFO-TYPE TLV-LENGTH
58 SignatureType
59 KeyLocator
60 ValidityPeriod
61 *CertificateExtension
62
63
64Name
65----
66
67The name of a certificate consists of five parts as shown below::
68
69 /<IdentityName>/KEY/<KeyId>/<IssuerId>/<Version>
70
71A certificate name starts with the name of the identity to which the public key is
72bound. The identity is followed by a literal ``KEY`` GenericNameComponent and by
73the *KeyId*, *IssuerId*, and *Version* components.
74
75*KeyId* is an opaque name component that identifies an instance of the public key in
76the certificate namespace. The value of *KeyId* is controlled by the namespace owner
77and can be an 8-byte random number, the SHA-256 digest of the certificate's public
78key, a timestamp, or any other unique numerical identifier.
79
80*IssuerId* is an opaque name component that identifies the issuer of the certificate.
81The value is controlled by the certificate issuer and, similar to *KeyId*, can be an
828-byte random number, the SHA-256 digest of the issuer's public key, or any other
83free-form identifier.
84
85*Version* represents the version number of the certificate. This component is encoded
86as a VersionNameComponent, following either revision 1 (marker-based) or revision 3
87(type-based) of the `NDN naming conventions
88<https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/>`__.
89
90For example:
91
92.. code-block:: text
93
94 /edu/ucla/cs/yingdi/KEY/%03%CD...%F1/%9F%D3...%B7/v=1617592200702
95 \_________________/ \___________/\___________/\______________/
96 Identity Name KeyId IssuerId Version
97
98
99MetaInfo
100--------
101
102The ``ContentType`` must be set to ``KEY`` (2).
103
104The ``FreshnessPeriod`` must be explicitly specified. The recommended value is 3,600,000 (1 hour).
105
106
107Content
108-------
109
110The ``Content`` element of a certificate contains the actual bits of the public key, formatted as
111a DER-encoded :rfc:`SubjectPublicKeyInfo <5280#section-4.1.2.7>` structure.
112
113
114SignatureInfo
115-------------
116
117The ``SignatureInfo`` element of a certificate is required to include a ``ValidityPeriod``
118element.
119
120``ValidityPeriod`` contains two TLV sub-elements: ``NotBefore`` and ``NotAfter``, each
121carrying a UTC timestamp in *ISO 8601-1:2019* compact format without the final "Z" character
122("YYYYMMDDThhmmss", e.g., "20201231T235959"). ``NotBefore`` indicates when the certificate
123takes effect while ``NotAfter`` indicates when the certificate expires.
124
125::
126
127 ValidityPeriod = VALIDITY-PERIOD-TYPE TLV-LENGTH
128 NotBefore
129 NotAfter
130
131 NotBefore = NOT-BEFORE-TYPE TLV-LENGTH IsoDate "T" IsoTime
132
133 NotAfter = NOT-AFTER-TYPE TLV-LENGTH IsoDate "T" IsoTime
134
135 IsoDate = 8DIGIT ; YYYYMMDD (UTC)
136
137 IsoTime = 6DIGIT ; hhmmss (UTC)
138
139
140Extensions
141----------
142
143A certificate may carry zero or more extension fields in its ``SignatureInfo`` element.
144
145An extension can be either critical or non-critical depending on its TLV-TYPE number.
146A critical TLV-TYPE means that if a validator cannot recognize or parse the extension,
147the validator must reject the whole certificate. Conversely, an extension with a
148non-critical TLV-TYPE may be ignored by the validator if it is not recognized. Refer to
149the general :ref:`evolvability rules <evolvability>` to determine whether a TLV-TYPE is
150critical or not.
151
152The TLV-TYPE number range [256, 511] is reserved for extensions. This document currently
153defines one extension: ``AdditionalDescription``.
154
155::
156
157 CertificateExtension = AdditionalDescription
158
159AdditionalDescription
160^^^^^^^^^^^^^^^^^^^^^
161
162``AdditionalDescription`` is a non-critical extension that provides additional
163information about the certificate. The information is expressed as a set of
164key-value pairs. Both key and value are UTF-8 strings, e.g.,
165``("Organization", "UCLA")``. The issuer of a certificate can specify arbitrary
166key-value pairs to provide further details about the certificate.
167
168::
169
170 AdditionalDescription = ADDITIONAL-DESCRIPTION-TYPE TLV-LENGTH
171 1*DescriptionEntry
172
173 DescriptionEntry = DESCRIPTION-ENTRY-TYPE TLV-LENGTH
174 DescriptionKey
175 DescriptionValue
176
177 DescriptionKey = DESCRIPTION-KEY-TYPE TLV-LENGTH 1*OCTET
178
179 DescriptionValue = DESCRIPTION-VALUE-TYPE TLV-LENGTH 1*OCTET