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