Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 1 | Signature |
| 2 | ========= |
| 3 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 4 | .. _DataSignature: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 5 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 6 | Data Signature |
| 7 | -------------- |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 8 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 9 | The NDN Data packet signature is defined as two consecutive TLV elements: ``SignatureInfo`` and ``SignatureValue``. |
Alexander Afanasyev | 7455e9b | 2014-06-25 09:41:08 -0700 | [diff] [blame] | 10 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 11 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 12 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 13 | DataSignature = SignatureInfo SignatureValue |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 14 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 15 | SignatureInfo = SIGNATURE-INFO-TYPE TLV-LENGTH |
| 16 | SignatureType |
| 17 | [KeyLocator] |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 18 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 19 | SignatureValue = SIGNATURE-VALUE-TYPE TLV-LENGTH *OCTET |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 20 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 21 | The ``SignatureInfo`` element fully describes the digital signature algorithm utilized and any other relevant information to locate its parent certificate(s), such as :ref:`KeyLocator`. |
| 22 | |
| 23 | The ``SignatureValue`` element holds the actual bits of the signature. The exact encoding of the TLV-VALUE of this element depends on the specific signature type. See :ref:`SignatureTypes` for details. |
| 24 | |
| 25 | The cryptographic signature contained in ``SignatureValue`` covers all TLV elements inside ``Data``, starting from ``Name`` and up to, but not including, ``SignatureValue``. |
| 26 | These TLV elements are hereby referred to as the "*signed portion*" of a Data packet. |
| 27 | |
| 28 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 29 | .. _InterestSignature: |
| 30 | |
| 31 | Interest Signature |
| 32 | ------------------ |
| 33 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 34 | The NDN Interest packet signature is defined as two consecutive TLV elements: ``InterestSignatureInfo`` and ``InterestSignatureValue``. |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 35 | |
| 36 | :: |
| 37 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 38 | InterestSignature = InterestSignatureInfo InterestSignatureValue |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 39 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 40 | InterestSignatureInfo = INTEREST-SIGNATURE-INFO-TYPE TLV-LENGTH |
| 41 | SignatureType |
| 42 | [KeyLocator] |
| 43 | [SignatureNonce] |
| 44 | [SignatureTime] |
| 45 | [SignatureSeqNum] |
| 46 | |
| 47 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE TLV-LENGTH *OCTET |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 48 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 49 | The ``InterestSignatureInfo`` element fully describes the digital signature algorithm utilized and any other relevant information to locate its parent certificate(s), such as :ref:`KeyLocator`. |
| 50 | To ensure the uniqueness of a signed Interest and to mitigate potential replay attacks, the ``InterestSignatureInfo`` element SHOULD include at least one of the following elements (described below): ``SignatureNonce``, ``SignatureTime``, ``SignatureSeqNum``. |
| 51 | |
| 52 | The ``InterestSignatureValue`` element holds the actual bits of the signature. The exact encoding of the TLV-VALUE of this element depends on the specific signature type. See :ref:`SignatureTypes` for details. |
| 53 | |
| 54 | The cryptographic signature contained in ``InterestSignatureValue`` covers all the ``NameComponent`` elements in the Interest's ``Name`` up to, but not including, ``ParametersSha256DigestComponent``, and the complete TLV elements starting from ``ApplicationParameters`` up to, but not including, ``InterestSignatureValue``. |
| 55 | These TLV elements are hereby referred to as the "*signed portion*" of an Interest packet. |
| 56 | |
| 57 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 58 | Signature Elements |
| 59 | ------------------ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 60 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 61 | SignatureType |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 62 | ^^^^^^^^^^^^^ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 63 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 64 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 65 | |
Davide Pesavento | f9353df | 2020-06-21 19:19:56 -0400 | [diff] [blame] | 66 | SignatureType = SIGNATURE-TYPE-TYPE TLV-LENGTH NonNegativeInteger |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 67 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 68 | This specification defines the following values for ``SignatureType``: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 69 | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 70 | +---------+----------------------------------------+-------------------------------------------------+ |
| 71 | | Value | Reference | Description | |
| 72 | +=========+========================================+=================================================+ |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 73 | | 0 | :ref:`DigestSha256` | Integrity protection using a SHA-256 digest | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 74 | +---------+----------------------------------------+-------------------------------------------------+ |
| 75 | | 1 | :ref:`SignatureSha256WithRsa` | Integrity and provenance protection using | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 76 | | | | an RSA signature over a SHA-256 digest | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 77 | +---------+----------------------------------------+-------------------------------------------------+ |
| 78 | | 3 | :ref:`SignatureSha256WithEcdsa` | Integrity and provenance protection using | |
| 79 | | | | an ECDSA signature over a SHA-256 digest | |
| 80 | +---------+----------------------------------------+-------------------------------------------------+ |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 81 | | 4 | :ref:`SignatureHmacWithSha256` | Integrity and provenance protection using | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 82 | | | | a SHA-256 hash-based message authentication code| |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 83 | +---------+----------------------------------------+-------------------------------------------------+ |
Junxiao Shi | ac25eab | 2022-05-27 10:52:17 +0000 | [diff] [blame] | 84 | | 5 | :ref:`SignatureEd25519` | Integrity and provenance protection using | |
| 85 | | | | an Ed25519 signature | |
| 86 | +---------+----------------------------------------+-------------------------------------------------+ |
| 87 | | 2,6-200 | | Reserved for future assignments | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 88 | +---------+----------------------------------------+-------------------------------------------------+ |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 89 | | >200 | | Unassigned | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 90 | +---------+----------------------------------------+-------------------------------------------------+ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 91 | |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 92 | .. _KeyLocator: |
| 93 | |
| 94 | KeyLocator |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 95 | ^^^^^^^^^^ |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 96 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 97 | A ``KeyLocator`` specifies either a ``Name`` that points to another Data packet containing a certificate or public key, or a ``KeyDigest`` that identifies the public key within a specific trust model (definition of the trust model is outside the scope of this specification). |
| 98 | Note that although ``KeyLocator`` is defined as an optional field in ``SignatureInfo`` and ``InterestSignatureInfo``, specific signature types may require its presence or absence. |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 99 | |
| 100 | :: |
| 101 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 102 | KeyLocator = KEY-LOCATOR-TYPE TLV-LENGTH (Name / KeyDigest) |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 103 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 104 | KeyDigest = KEY-DIGEST-TYPE TLV-LENGTH *OCTET |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 105 | |
Davide Pesavento | ec288fe | 2022-11-26 18:28:01 -0500 | [diff] [blame] | 106 | See :ref:`Name` for the definition of the ``Name`` element. |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 107 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 108 | The specific definition of the proper usage of the ``Name`` and ``KeyDigest`` options in the ``KeyLocator`` field is outside the scope of this specification. |
Davide Pesavento | 3a74e13 | 2022-11-26 22:10:21 -0500 | [diff] [blame] | 109 | Generally, ``Name`` names the Data packet containing the corresponding :ref:`certificate <Certificate>`. |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 110 | However, it is up to the specific trust model to define whether this name is the full name of the Data packet or a prefix that can match multiple Data packets. |
Davide Pesavento | 52c88cb | 2021-12-02 16:58:02 -0500 | [diff] [blame] | 111 | For example, the `hierarchical trust model`_ uses the latter approach, requiring clients to fetch the latest version of the Data packet pointed to by ``KeyLocator`` (the latest version of the public key certificate) in order to ensure that the public key was not yet revoked. |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 112 | |
| 113 | SignatureNonce |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 114 | ^^^^^^^^^^^^^^ |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 115 | |
| 116 | :: |
| 117 | |
Eric Newberry | 437dc8c | 2020-05-29 09:48:18 -0700 | [diff] [blame] | 118 | SignatureNonce = SIGNATURE-NONCE-TYPE TLV-LENGTH 1*OCTET |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 119 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 120 | The ``SignatureNonce`` element adds additional assurances that a signature will be unique. |
Eric Newberry | 437dc8c | 2020-05-29 09:48:18 -0700 | [diff] [blame] | 121 | The recommended minimum length for a ``SignatureNonce`` element is 8 octets. |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 122 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 123 | SignatureTime |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 124 | ^^^^^^^^^^^^^ |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 125 | |
| 126 | :: |
| 127 | |
Davide Pesavento | f9353df | 2020-06-21 19:19:56 -0400 | [diff] [blame] | 128 | SignatureTime = SIGNATURE-TIME-TYPE TLV-LENGTH NonNegativeInteger |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 129 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 130 | The value of the ``SignatureTime`` element is the timestamp of the signature, represented as the number of milliseconds since 1970-01-01T00:00:00Z (Unix epoch). |
| 131 | This element can be used to indicate that the packet was signed at a particular point in time. |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 132 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 133 | SignatureSeqNum |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 134 | ^^^^^^^^^^^^^^^ |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 135 | |
| 136 | :: |
| 137 | |
Davide Pesavento | f9353df | 2020-06-21 19:19:56 -0400 | [diff] [blame] | 138 | SignatureSeqNum = SIGNATURE-SEQ-NUM-TYPE TLV-LENGTH NonNegativeInteger |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 139 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 140 | The ``SignatureSeqNum`` element adds additional assurances that a signature will be unique. |
| 141 | The ``SignatureSeqNum`` may be used to protect against replay attacks. |
| 142 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 143 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 144 | .. _SignatureTypes: |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 145 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 146 | Different Types of Signatures |
| 147 | ----------------------------- |
| 148 | |
| 149 | Each signature type has different requirements on the format of its ``SignatureInfo`` and ``InterestSignatureInfo`` elements. |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 150 | In the following sections, these requirements are specified along 2 dimensions: |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 151 | |
| 152 | * The TLV-VALUE of ``SignatureType`` |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 153 | * Whether ``KeyLocator`` is required/forbidden |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 154 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 155 | .. _DigestSha256: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 156 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 157 | DigestSha256 |
| 158 | ^^^^^^^^^^^^ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 159 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 160 | ``DigestSha256`` provides no information about the provenance of a packet or any guarantee that the packet is from the original source. |
| 161 | This signature type is intended only for debug purposes and in the limited circumstances when it is necessary to protect only against unexpected modification during transmission. |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 162 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 163 | ``DigestSha256`` is defined as the SHA-256 hash of the "signed portion" of an Interest or Data packet: |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 164 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 165 | * The TLV-VALUE of ``SignatureType`` is 0 |
| 166 | * ``KeyLocator`` is forbidden; if present, it must be ignored |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 167 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 168 | :: |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 169 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 170 | SignatureValue = SIGNATURE-VALUE-TYPE |
| 171 | TLV-LENGTH ; == 32 |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 172 | 32OCTET ; == SHA-256{Data signed portion} |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 173 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 174 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE |
| 175 | TLV-LENGTH ; == 32 |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 176 | 32OCTET ; == SHA-256{Interest signed portion} |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 177 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 178 | .. _SignatureSha256WithRsa: |
| 179 | |
| 180 | SignatureSha256WithRsa |
| 181 | ^^^^^^^^^^^^^^^^^^^^^^ |
| 182 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 183 | ``SignatureSha256WithRsa`` defines an RSA public key signature that is calculated over the SHA-256 hash of the "signed portion" of an Interest or Data packet. |
Davide Pesavento | 4d6c357 | 2022-05-27 12:05:05 -0400 | [diff] [blame] | 184 | It uses the RSASSA-PKCS1-v1_5 signature scheme, as defined in :rfc:`RFC 8017, Section 8.2 <8017#section-8.2>`. |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 185 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 186 | * The TLV-VALUE of ``SignatureType`` is 1 |
| 187 | * ``KeyLocator`` is required |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 188 | |
| 189 | :: |
| 190 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 191 | SignatureValue = SIGNATURE-VALUE-TYPE |
| 192 | TLV-LENGTH |
| 193 | 1*OCTET ; == RSA over SHA-256{Data signed portion} |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 194 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 195 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE |
| 196 | TLV-LENGTH |
| 197 | 1*OCTET ; == RSA over SHA-256{Interest signed portion} |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 198 | |
Alexander Afanasyev | 16962fc | 2014-02-12 19:53:47 +0000 | [diff] [blame] | 199 | .. note:: |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 200 | The TLV-LENGTH of these elements varies depending on the length of the private key used for signing (e.g., 256 bytes for a 2048-bit key). |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 201 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 202 | This type of signature, if verified, provides very strong assurances that a packet was created by the claimed producer (authentication/provenance) and was not tampered with while in transit (integrity). |
Davide Pesavento | 4d6c357 | 2022-05-27 12:05:05 -0400 | [diff] [blame] | 203 | The ``KeyDigest`` option in :ref:`KeyLocator` is defined as the SHA-256 digest over the DER encoding of the ``SubjectPublicKeyInfo`` for an RSA key as defined by :rfc:`3279`. |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 204 | |
| 205 | .. note:: |
Davide Pesavento | 23e340c | 2021-12-03 04:52:22 -0500 | [diff] [blame] | 206 | It is the application's responsibility to define rules (a trust model) concerning when a specific issuer (``KeyLocator``) is authorized to sign a specific packet. |
| 207 | While trust models are outside the scope of this specification, generally, trust models need to specify authorization rules between key names and Data packet names, as well as clearly define trust anchor(s). |
| 208 | For example, an application can elect to use a `hierarchical trust model`_ to ensure Data integrity and provenance. |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 209 | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 210 | .. _SignatureSha256WithEcdsa: |
| 211 | |
| 212 | SignatureSha256WithEcdsa |
| 213 | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 214 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 215 | ``SignatureSha256WithEcdsa`` defines an ECDSA public key signature that is calculated over the SHA-256 hash of the "signed portion" of an Interest or Data packet. |
Davide Pesavento | 4d6c357 | 2022-05-27 12:05:05 -0400 | [diff] [blame] | 216 | This signature algorithm is defined in :rfc:`RFC 5753, Section 2.1 <5753#section-2.1>`. |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 217 | All NDN implementations MUST support this signature type with the NIST P-256 curve. |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 218 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 219 | * The TLV-VALUE of ``SignatureType`` is 3 |
| 220 | * ``KeyLocator`` is required |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 221 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 222 | :: |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 223 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 224 | SignatureValue = SIGNATURE-VALUE-TYPE |
| 225 | TLV-LENGTH |
| 226 | 1*OCTET ; == ECDSA over SHA-256{Data signed portion} |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 227 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 228 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE |
| 229 | TLV-LENGTH |
| 230 | 1*OCTET ; == ECDSA over SHA-256{Interest signed portion} |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 231 | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 232 | .. note:: |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 233 | The TLV-LENGTH of these elements depends on the specific elliptic curve used for signing (e.g., up to 72 bytes for the NIST P-256 curve). |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 234 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 235 | This type of signature, if verified, provides very strong assurances that a packet was created by the claimed producer (authentication/provenance) and was not tampered with while in transit (integrity). |
Davide Pesavento | 4d6c357 | 2022-05-27 12:05:05 -0400 | [diff] [blame] | 236 | The ``KeyDigest`` option in :ref:`KeyLocator` is defined as the SHA-256 digest of the DER encoding of the ``SubjectPublicKeyInfo`` for an EC key as defined by :rfc:`5480`. |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 237 | |
Davide Pesavento | 4d6c357 | 2022-05-27 12:05:05 -0400 | [diff] [blame] | 238 | The value of ``SignatureValue`` of ``SignatureSha256WithEcdsa`` is a DER-encoded ``Ecdsa-Sig-Value`` structure as defined in :rfc:`RFC 3279, Section 2.2.3 <3279#section-2.2.3>`. |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 239 | |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 240 | .. _SignatureHmacWithSha256: |
| 241 | |
| 242 | SignatureHmacWithSha256 |
| 243 | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 244 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 245 | ``SignatureHmacWithSha256`` defines a hash-based message authentication code (HMAC) that is calculated over the "signed portion" of an Interest or Data packet, using SHA-256 as the hash function, salted with a shared secret key. |
Davide Pesavento | 4d6c357 | 2022-05-27 12:05:05 -0400 | [diff] [blame] | 246 | This signature algorithm is defined in :rfc:`RFC 2104, Section 2 <2104#section-2>`. |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 247 | |
Davide Pesavento | 23e340c | 2021-12-03 04:52:22 -0500 | [diff] [blame] | 248 | .. warning:: |
Davide Pesavento | 4d6c357 | 2022-05-27 12:05:05 -0400 | [diff] [blame] | 249 | As stated in :rfc:`RFC 2104, Section 3 <2104#section-3>`, shared keys shorter than the SHA-256 output length (32 bytes) are strongly discouraged. |
Davide Pesavento | 23e340c | 2021-12-03 04:52:22 -0500 | [diff] [blame] | 250 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 251 | * The TLV-VALUE of ``SignatureType`` is 4 |
| 252 | * ``KeyLocator`` is required |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 253 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 254 | :: |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 255 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 256 | SignatureValue = SIGNATURE-VALUE-TYPE |
| 257 | TLV-LENGTH ; == 32 |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 258 | 32OCTET ; == HMAC-SHA-256{Data signed portion} |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 259 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 260 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE |
| 261 | TLV-LENGTH ; == 32 |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 262 | 32OCTET ; == HMAC-SHA-256{Interest signed portion} |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 263 | |
Davide Pesavento | 3c0bc31 | 2020-05-18 22:03:09 -0400 | [diff] [blame] | 264 | Provided that the signature verifies, this type of signature ensures the authenticity of the packet, namely, that it was signed by a party possessing the shared key, and that it was not altered in transit (integrity). |
| 265 | The shared key used to generate the HMAC signature can be identified by the :ref:`KeyLocator` element, e.g., by using the ``Name`` according to the application's naming conventions. |
| 266 | It is the application's responsibility to associate the shared key with the identities of the parties who hold the shared key. |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 267 | |
Davide Pesavento | 23e340c | 2021-12-03 04:52:22 -0500 | [diff] [blame] | 268 | .. danger:: |
| 269 | The shared secret key is not included in the signature and must not be included anywhere in the packet, as this would invalidate the security properties of HMAC. |
| 270 | |
Junxiao Shi | ac25eab | 2022-05-27 10:52:17 +0000 | [diff] [blame] | 271 | .. _SignatureEd25519: |
| 272 | |
| 273 | SignatureEd25519 |
| 274 | ^^^^^^^^^^^^^^^^ |
| 275 | |
| 276 | ``SignatureEd25519`` defines an Ed25519 public key signature that is calculated over the "signed portion" of an Interest or Data packet. |
Davide Pesavento | 4d6c357 | 2022-05-27 12:05:05 -0400 | [diff] [blame] | 277 | This signature algorithm is defined in :rfc:`RFC 8032, Section 5.1 <8032#section-5.1>`. |
Junxiao Shi | ac25eab | 2022-05-27 10:52:17 +0000 | [diff] [blame] | 278 | |
| 279 | * The TLV-VALUE of ``SignatureType`` is 5 |
| 280 | * ``KeyLocator`` is required |
| 281 | |
| 282 | :: |
| 283 | |
| 284 | SignatureValue = SIGNATURE-VALUE-TYPE |
| 285 | TLV-LENGTH |
| 286 | 64OCTET ; == Ed25519{Data signed portion} |
| 287 | |
| 288 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE |
| 289 | TLV-LENGTH |
| 290 | 64OCTET ; == Ed25519{Interest signed portion} |
| 291 | |
| 292 | This type of signature, if verified, provides very strong assurances that a packet was created by the claimed producer (authentication/provenance) and was not tampered with while in transit (integrity). |
Davide Pesavento | 4d6c357 | 2022-05-27 12:05:05 -0400 | [diff] [blame] | 293 | The ``KeyDigest`` option in :ref:`KeyLocator` is defined as the SHA-256 digest over the DER encoding of the ``SubjectPublicKeyInfo`` for an Ed25519 key as defined by :rfc:`RFC 8410, Section 4 <8410#section-4>`. |
Junxiao Shi | ac25eab | 2022-05-27 10:52:17 +0000 | [diff] [blame] | 294 | |
Davide Pesavento | 52c88cb | 2021-12-02 16:58:02 -0500 | [diff] [blame] | 295 | .. _hierarchical trust model: https://named-data.net/publications/techreports/trpublishkey-rev2/ |