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 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 50 | CertificateV2 ::= DATA-TLV TLV-LENGTH |
| 51 | Name (= /<NameSpace>/KEY/[KeyId]/[IssuerId]/[Version]) |
| 52 | MetaInfo (.ContentType = KEY, |
| 53 | .FreshnessPeriod >~ 1h)) |
| 54 | Content (= X509PublicKeyContent) |
| 55 | SignatureInfo (= CertificateV2SignatureInfo) |
| 56 | SignatureValue |
| 57 | |
| 58 | X509PublicKeyContent ::= CONTENT-TLV TLV-LENGTH |
| 59 | BYTE+ (= public key bits in PKCS#8 format) |
| 60 | |
| 61 | CertificateV2SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH |
| 62 | SignatureType |
| 63 | KeyLocator |
| 64 | ValidityPeriod |
| 65 | ... optional critical or non-critical extension blocks ... |
| 66 | |
| 67 | |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 68 | Name |
| 69 | ---- |
| 70 | |
Yingdi Yu | 7f8e8fe | 2015-11-04 12:24:11 -0800 | [diff] [blame] | 71 | The name of a certificate consists of five parts as shown below: |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 72 | |
| 73 | :: |
| 74 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 75 | /<SubjectName>/KEY/[KeyId]/[IssuerId]/[Version] |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 76 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 77 | A certificate name starts with the subject to which a public key is bound. The following parts |
| 78 | include the keyword ``KEY`` component, KeyId, IssuerId, and version components. |
| 79 | |
| 80 | ``KeyId`` is an opaque name component to identify an instance of the public key for the |
| 81 | certificate namespace. The value of `Key ID` is controlled by the namespace owner and can be |
| 82 | an 8-byte random number, SHA-256 digest of the public key, timestamp, or a simple numerical |
| 83 | identifier. |
| 84 | |
| 85 | ``Issuer Id`` is an opaque name component to identify issuer of the certificate. The value is |
| 86 | controlled by the certificate issuer and, similar to KeyId, can be an 8-byte random number, |
| 87 | SHA-256 digest of the issuer's public key, or a simple numerical identifier. |
| 88 | |
| 89 | |
Yingdi Yu | 7f8e8fe | 2015-11-04 12:24:11 -0800 | [diff] [blame] | 90 | For example, |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 91 | |
| 92 | :: |
| 93 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 94 | /edu/ucla/cs/yingdi/KEY/%03%CD...%F1/%9F%D3...%B7/%FD%d2...%8E |
| 95 | \_________________/ \___________/ \___________/\___________/ |
| 96 | Certificate Namespace Key Id Issuer Id Version |
| 97 | (Identity) |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 98 | |
| 99 | |
| 100 | MetaInfo |
| 101 | -------- |
| 102 | |
| 103 | The ``ContentType`` of certificate is set to ``KEY`` (2). |
| 104 | |
| 105 | The ``FreshnessPeriod`` of certificate must be explicitly specified. The |
| 106 | recommended value is 1 hour (3,600,000 milliseconds). |
| 107 | |
| 108 | Content |
| 109 | ------- |
| 110 | |
| 111 | By default, the content of a certificate is the public key encoded in |
| 112 | `X509PublicKey <https://tools.ietf.org/html/rfc5280#section-4.1.2.7>`__ format. |
| 113 | |
| 114 | SignatureInfo |
| 115 | ------------- |
| 116 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 117 | The SignatureInfo block of a certificate is required to include the ``ValidityPeriod`` field. |
| 118 | ``ValidityPeriod`` includes two sub TLV fields: ``NotBefore`` and ``NotAfter``, which carry two |
| 119 | UTC timestamps in ISO 8601 compact format (``yyyymmddTHHMMSS``, e.g., "20020131T235959"). |
| 120 | ``NotBefore`` indicates when the certificate takes effect while ``NotAfter`` indicates when the |
| 121 | certificate expires. |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 122 | |
| 123 | .. note:: |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 124 | Using ISO style string is the convention of specifying the validity period of certificate, |
| 125 | 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] | 126 | |
| 127 | :: |
| 128 | |
| 129 | ValidityPeriod ::= VALIDITY-PERIOD-TYPE TLV-LENGTH |
| 130 | NotBefore |
| 131 | NotAfter |
| 132 | |
| 133 | NotBefore ::= NOT-BEFORE-TYPE TLV-LENGTH |
| 134 | BYTE{15} |
| 135 | |
| 136 | NotAfter ::= NOT-AFTER-TYPE TLV-LENGTH |
| 137 | BYTE{15} |
| 138 | |
| 139 | For each TLV, the TLV-TYPE codes are assigned as below: |
| 140 | |
| 141 | +---------------------------------------------+-------------------+----------------+ |
| 142 | | TLV-TYPE | Assigned code | Assigned code | |
| 143 | | | (decimal) | (hexadecimal) | |
| 144 | +=============================================+===================+================+ |
| 145 | | ValidityPeriod | 253 | 0xFD | |
| 146 | +---------------------------------------------+-------------------+----------------+ |
| 147 | | NotBefore | 254 | 0xFE | |
| 148 | +---------------------------------------------+-------------------+----------------+ |
| 149 | | NotAfter | 255 | 0xFF | |
| 150 | +---------------------------------------------+-------------------+----------------+ |
| 151 | |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 152 | Extensions |
| 153 | ~~~~~~~~~~ |
| 154 | |
| 155 | A certificate may optionally carry some extensions in SignatureInfo. An extension |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 156 | could be either critical or non-critical depends on the TLV-TYPE code convention. A |
| 157 | critical extension implies that if a validator cannot recognize or parse the |
| 158 | extension, the validator must reject the certificate. A non-critical extension |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 159 | implies that if a validator cannot recognize or cannot parse the extension, the |
| 160 | validator may ignore the extension. |
| 161 | |
| 162 | The TLV-TYPE code range [256, 512) is reserved for extensions. The last bit of a |
| 163 | TLV-TYPE code indicates whether the extension is critical or not: ``1`` for critical |
| 164 | while ``0`` for non-critical. If an extension could be either critical or |
| 165 | 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] | 166 | differ at the last bit. |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 167 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 168 | Extensions |
| 169 | ---------- |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 170 | |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 171 | We list currently defined extensions: |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 172 | |
| 173 | +---------------------------------------------+-------------------+----------------+ |
| 174 | | TLV-TYPE | Assigned code | Assigned code | |
| 175 | | | (decimal) | (hexadecimal) | |
| 176 | +=============================================+===================+================+ |
Zhiyi Zhang | f4bb5c7 | 2015-08-19 19:02:51 -0700 | [diff] [blame] | 177 | | AdditionalDescription (non-critical) | 258 | 0x0102 | |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 178 | +---------------------------------------------+-------------------+----------------+ |
Yingdi Yu | fba8a63 | 2015-06-08 22:25:54 -0700 | [diff] [blame] | 179 | |
| 180 | AdditionalDescription |
| 181 | ~~~~~~~~~~~~~~~~~~~~~ |
| 182 | |
| 183 | ``AdditionalDescription`` is a non-critical extension that provides additional |
| 184 | information about the certificate. The information is expressed as a set of |
| 185 | key-value pairs. Both key and value are UTF-8 strings, e.g., |
| 186 | ``("Organization", "UCLA")``. The issuer of a certificate can specify arbitrary |
| 187 | key-value pair to provide additional description about the certificate. |
| 188 | |
| 189 | :: |
| 190 | |
| 191 | AdditionalDescription ::= ADDITIONAL-DESCRIPTION-TYPE TLV-LENGTH |
| 192 | DescriptionEntry+ |
| 193 | |
| 194 | DescriptionEntry ::= DESCRIPTION-ENTRY-TYPE TLV-LENGTH |
| 195 | DescriptionKey |
| 196 | DescriptionValue |
| 197 | |
| 198 | DescriptionKey ::= DESCRIPTION-KEY-TYPE TLV-LENGTH |
| 199 | BYTE+ |
| 200 | |
| 201 | DescriptionValue ::= DESCRIPTION-VALUE-TYPE TLV-LENGTH |
| 202 | BYTE+ |
| 203 | |
| 204 | +---------------------------------------------+-------------------+----------------+ |
| 205 | | TLV-TYPE | Assigned code | Assigned code | |
| 206 | | | (decimal) | (hexadecimal) | |
| 207 | +=============================================+===================+================+ |
| 208 | | DescriptionEntry | 512 | 0x0200 | |
| 209 | +---------------------------------------------+-------------------+----------------+ |
| 210 | | DescriptionKey | 513 | 0x0201 | |
| 211 | +---------------------------------------------+-------------------+----------------+ |
| 212 | | DescriptionValue | 514 | 0x0202 | |
| 213 | +---------------------------------------------+-------------------+----------------+ |