Davide Pesavento | 3a74e13 | 2022-11-26 22:10:21 -0500 | [diff] [blame] | 1 | .. _Certificate: |
| 2 | |
| 3 | Certificate |
| 4 | =========== |
| 5 | |
| 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 alone is not sufficient to serve as the |
| 11 | specification of a common NDN certificate format, because additional provisions |
| 12 | are required for the latter. For example, a certificate follows a specific |
| 13 | naming scheme and may need to include validity period, revocation information, |
| 14 | etc. 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 | |
| 64 | Name |
| 65 | ---- |
| 66 | |
| 67 | The name of a certificate consists of five parts as shown below:: |
| 68 | |
| 69 | /<IdentityName>/KEY/<KeyId>/<IssuerId>/<Version> |
| 70 | |
| 71 | A certificate name starts with the name of the identity to which the public key is |
| 72 | bound. The identity is followed by a literal ``KEY`` GenericNameComponent and by |
| 73 | the *KeyId*, *IssuerId*, and *Version* components. |
| 74 | |
| 75 | *KeyId* is an opaque name component that identifies an instance of the public key in |
| 76 | the certificate namespace. The value of *KeyId* is controlled by the namespace owner |
| 77 | and can be an 8-byte random number, the SHA-256 digest of the certificate's public |
| 78 | key, a timestamp, or any other unique numerical identifier. |
| 79 | |
| 80 | *IssuerId* is an opaque name component that identifies the issuer of the certificate. |
| 81 | The value is controlled by the certificate issuer and, similar to *KeyId*, can be an |
| 82 | 8-byte random number, the SHA-256 digest of the issuer's public key, or any other |
| 83 | free-form identifier. |
| 84 | |
| 85 | *Version* represents the version number of the certificate. This component is encoded |
| 86 | as 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 | |
| 90 | For 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 | |
| 99 | MetaInfo |
| 100 | -------- |
| 101 | |
| 102 | The ``ContentType`` must be set to ``KEY`` (2). |
| 103 | |
| 104 | The ``FreshnessPeriod`` must be explicitly specified. The recommended value is 3,600,000 (1 hour). |
| 105 | |
| 106 | |
| 107 | Content |
| 108 | ------- |
| 109 | |
| 110 | The ``Content`` element of a certificate contains the actual bits of the public key, formatted as |
| 111 | a DER-encoded :rfc:`SubjectPublicKeyInfo <5280#section-4.1.2.7>` structure. |
| 112 | |
| 113 | |
| 114 | SignatureInfo |
| 115 | ------------- |
| 116 | |
| 117 | The ``SignatureInfo`` element of a certificate is required to include a ``ValidityPeriod`` |
| 118 | element. |
| 119 | |
| 120 | ``ValidityPeriod`` contains two TLV sub-elements: ``NotBefore`` and ``NotAfter``, each |
| 121 | carrying 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 |
| 123 | takes 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 | |
| 140 | Extensions |
| 141 | ---------- |
| 142 | |
| 143 | A certificate may carry zero or more extension fields in its ``SignatureInfo`` element. |
| 144 | |
| 145 | An extension can be either critical or non-critical depending on its TLV-TYPE number. |
| 146 | A critical TLV-TYPE means that if a validator cannot recognize or parse the extension, |
| 147 | the validator must reject the whole certificate. Conversely, an extension with a |
| 148 | non-critical TLV-TYPE may be ignored by the validator if it is not recognized. Refer to |
| 149 | the general :ref:`evolvability rules <evolvability>` to determine whether a TLV-TYPE is |
| 150 | critical or not. |
| 151 | |
| 152 | The TLV-TYPE number range [256, 511] is reserved for extensions. This document currently |
| 153 | defines one extension: ``AdditionalDescription``. |
| 154 | |
| 155 | :: |
| 156 | |
| 157 | CertificateExtension = AdditionalDescription |
| 158 | |
| 159 | AdditionalDescription |
| 160 | ^^^^^^^^^^^^^^^^^^^^^ |
| 161 | |
| 162 | ``AdditionalDescription`` is a non-critical extension that provides additional |
| 163 | information about the certificate. The information is expressed as a set of |
| 164 | key-value pairs. Both key and value are UTF-8 strings, e.g., |
| 165 | ``("Organization", "UCLA")``. The issuer of a certificate can specify arbitrary |
| 166 | key-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 |