Alexander Afanasyev | aa8b378 | 2017-01-19 20:04:31 -0800 | [diff] [blame] | 1 | .. _NDN Certificate Format Version 2.0: |
| 2 | |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 3 | NDN Certificate Format Version 2.0 |
| 4 | ================================== |
| 5 | |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 6 | Since signature verification is a common operation in NDN applications, it is |
| 7 | important to define a common certificate format to standardize the public key |
| 8 | authentication procedure. As every NDN data packet is signed, a data packet |
| 9 | that carries a public key as content is conceptually a certificate. However, |
| 10 | the specification of a data packet is not sufficient to be the specification of |
| 11 | a common certificate format, as it requires additional components. For example, |
| 12 | a certificate may follow a specific naming convention and may need to include |
| 13 | validity period, revocation information, etc. This specification defines |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 14 | naming and structure of the NDN certificates and is complementary to NDN packet |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 15 | specification. |
| 16 | |
| 17 | :: |
| 18 | |
| 19 | Overview of NDN certificate format |
| 20 | +--------------------------+ |
| 21 | | Name | |
| 22 | +--------------------------+ |
| 23 | | MetaInfo | |
| 24 | |+------------------------+| |
| 25 | || ContentType: KEY(2) || |
| 26 | |+------------------------+| |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 27 | |+------------------------+| |
| 28 | || FreshnessPeriod: >~ 1h || |
| 29 | |+------------------------+| |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 30 | +--------------------------+ |
| 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 Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame^] | 47 | .. code-block:: abnf |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 48 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame^] | 49 | 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 Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 55 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame^] | 56 | CertificateV2SignatureInfo = SIGNATURE-INFO-TYPE TLV-LENGTH |
| 57 | SignatureType |
| 58 | KeyLocator |
| 59 | ValidityPeriod |
| 60 | *CertificateV2Extension |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 61 | |
| 62 | |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 63 | Name |
| 64 | ---- |
| 65 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame^] | 66 | The name of a certificate consists of five parts as shown below:: |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 67 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 68 | /<SubjectName>/KEY/[KeyId]/[IssuerId]/[Version] |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 69 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 70 | A certificate name starts with the subject to which a public key is bound. The following parts |
| 71 | include 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 |
| 74 | certificate namespace. The value of `Key ID` is controlled by the namespace owner and can be |
| 75 | an 8-byte random number, SHA-256 digest of the public key, timestamp, or a simple numerical |
| 76 | identifier. |
| 77 | |
| 78 | ``Issuer Id`` is an opaque name component to identify issuer of the certificate. The value is |
| 79 | controlled by the certificate issuer and, similar to KeyId, can be an 8-byte random number, |
| 80 | SHA-256 digest of the issuer's public key, or a simple numerical identifier. |
| 81 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame^] | 82 | For example:: |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 83 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 84 | /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 Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 88 | |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 89 | MetaInfo |
| 90 | -------- |
| 91 | |
| 92 | The ``ContentType`` of certificate is set to ``KEY`` (2). |
| 93 | |
| 94 | The ``FreshnessPeriod`` of certificate must be explicitly specified. The |
| 95 | recommended value is 1 hour (3,600,000 milliseconds). |
| 96 | |
| 97 | Content |
| 98 | ------- |
| 99 | |
| 100 | By 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 | |
| 103 | SignatureInfo |
| 104 | ------------- |
| 105 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 106 | The 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 |
| 108 | UTC timestamps in ISO 8601 compact format (``yyyymmddTHHMMSS``, e.g., "20020131T235959"). |
| 109 | ``NotBefore`` indicates when the certificate takes effect while ``NotAfter`` indicates when the |
| 110 | certificate expires. |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 111 | |
| 112 | .. note:: |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 113 | 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 Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 115 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame^] | 116 | .. code-block:: abnf |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 117 | |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 118 | ValidityPeriod = VALIDITY-PERIOD-TYPE TLV-LENGTH |
| 119 | NotBefore |
| 120 | NotAfter |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 121 | |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 122 | NotBefore = NOT-BEFORE-TYPE TLV-LENGTH 8DIGIT "T" 6DIGIT |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 123 | |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 124 | NotAfter = NOT-AFTER-TYPE TLV-LENGTH 8DIGIT "T" 6DIGIT |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 125 | |
| 126 | For 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 Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 139 | Extensions |
| 140 | ~~~~~~~~~~ |
| 141 | |
| 142 | A certificate may optionally carry some extensions in SignatureInfo. An extension |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 143 | could be either critical or non-critical depends on the TLV-TYPE code convention. A |
| 144 | critical extension implies that if a validator cannot recognize or parse the |
| 145 | extension, the validator must reject the certificate. A non-critical extension |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 146 | implies that if a validator cannot recognize or cannot parse the extension, the |
| 147 | validator may ignore the extension. |
| 148 | |
| 149 | The TLV-TYPE code range [256, 512) is reserved for extensions. The last bit of a |
| 150 | TLV-TYPE code indicates whether the extension is critical or not: ``1`` for critical |
| 151 | while ``0`` for non-critical. If an extension could be either critical or |
| 152 | non-critical, the extension should be allocated with two TLV-TYPE codes which only |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 153 | differ at the last bit. |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 154 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 155 | Extensions |
| 156 | ---------- |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 157 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 158 | We list currently defined extensions: |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 159 | |
| 160 | +---------------------------------------------+-------------------+----------------+ |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 161 | | TLV-TYPE | Assigned number | Assigned number| |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 162 | | | (decimal) | (hexadecimal) | |
| 163 | +=============================================+===================+================+ |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 164 | | AdditionalDescription (non-critical) | 258 | 0x0102 | |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 165 | +---------------------------------------------+-------------------+----------------+ |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 166 | |
| 167 | AdditionalDescription |
| 168 | ~~~~~~~~~~~~~~~~~~~~~ |
| 169 | |
| 170 | ``AdditionalDescription`` is a non-critical extension that provides additional |
| 171 | information about the certificate. The information is expressed as a set of |
| 172 | key-value pairs. Both key and value are UTF-8 strings, e.g., |
| 173 | ``("Organization", "UCLA")``. The issuer of a certificate can specify arbitrary |
| 174 | key-value pair to provide additional description about the certificate. |
| 175 | |
Davide Pesavento | 933a567 | 2020-07-03 22:32:43 -0400 | [diff] [blame^] | 176 | .. code-block:: abnf |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 177 | |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 178 | CertificateV2Extension = AdditionalDescription |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 179 | |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 180 | AdditionalDescription = ADDITIONAL-DESCRIPTION-TYPE TLV-LENGTH |
| 181 | 1*DescriptionEntry |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 182 | |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 183 | DescriptionEntry = DESCRIPTION-ENTRY-TYPE TLV-LENGTH |
| 184 | DescriptionKey |
| 185 | DescriptionValue |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 186 | |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 187 | DescriptionKey = DESCRIPTION-KEY-TYPE TLV-LENGTH 1*OCTET |
| 188 | |
| 189 | DescriptionValue = DESCRIPTION-VALUE-TYPE TLV-LENGTH 1*OCTET |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 190 | |
| 191 | +---------------------------------------------+-------------------+----------------+ |
Junxiao Shi | 9a04dda | 2019-07-02 15:18:20 +0000 | [diff] [blame] | 192 | | TLV-TYPE | Assigned number | Assigned number| |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 193 | | | (decimal) | (hexadecimal) | |
| 194 | +=============================================+===================+================+ |
| 195 | | DescriptionEntry | 512 | 0x0200 | |
| 196 | +---------------------------------------------+-------------------+----------------+ |
| 197 | | DescriptionKey | 513 | 0x0201 | |
| 198 | +---------------------------------------------+-------------------+----------------+ |
| 199 | | DescriptionValue | 514 | 0x0202 | |
| 200 | +---------------------------------------------+-------------------+----------------+ |