Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 1 | Signature |
| 2 | ========= |
| 3 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 4 | .. _Signature: |
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 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 9 | NDN Data Signature is defined as two consecutive TLV blocks: ``SignatureInfo`` and ``SignatureValue``. |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 10 | The following general considerations about SignatureInfo and SignatureValue blocks that apply for all signature types: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 11 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 12 | 1. ``SignatureInfo`` is **included** in signature calculation and fully describes the signature, signature algorithm, and any other relevant information to obtain parent certificate(s), such as :ref:`KeyLocator`. |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 13 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 14 | 2. ``SignatureValue`` is **excluded** from signature calculation and represent actual bits of the signature and any other supporting signature material. |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 15 | |
Alexander Afanasyev | 7455e9b | 2014-06-25 09:41:08 -0700 | [diff] [blame] | 16 | The reason for separating the signature into two separate TLV blocks is to allow efficient signing of a contiguous memory block (e.g., for Data packet this block starts from Name TLV and ends with SignatureInfo TLV). |
| 17 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 18 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 19 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 20 | DataSignature = SignatureInfo SignatureValue |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 21 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 22 | SignatureInfo = SIGNATURE-INFO-TYPE TLV-LENGTH |
| 23 | SignatureType |
| 24 | [KeyLocator] |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 25 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 26 | SignatureValue = SIGNATURE-VALUE-TYPE TLV-LENGTH *OCTET |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 27 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 28 | .. _InterestSignature: |
| 29 | |
| 30 | Interest Signature |
| 31 | ------------------ |
| 32 | |
| 33 | NDN Interest Signature is defined as two consecutive TLV blocks: ``InterestSignatureInfo`` and ``InterestSignatureValue``. |
| 34 | |
| 35 | To ensure uniqueness of the signed Interest name and to mitigate potential replay attacks, the ``InterestSignatureInfo`` element can include a ``SignatureNonce`` element, ``SignatureTime`` element, and/or ``SignatureSeqNum`` element. |
| 36 | |
| 37 | The cryptographic signature in the ``InterestSignatureValue`` element covers all the ``NameComponent`` elements inside ``Name`` up to but not including ``ParametersSha256DigestComponent`` component, and the complete TLVs starting from ``ApplicationParameters`` up until but not including ``InterestSignatureValue``. |
| 38 | |
| 39 | |
| 40 | :: |
| 41 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 42 | InterestSignature = InterestSignatureInfo InterestSignatureValue |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 43 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 44 | InterestSignatureInfo = INTEREST-SIGNATURE-INFO-TYPE TLV-LENGTH |
| 45 | SignatureType |
| 46 | [KeyLocator] |
| 47 | [SignatureNonce] |
| 48 | [SignatureTime] |
| 49 | [SignatureSeqNum] |
| 50 | |
| 51 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE TLV-LENGTH *OCTET |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 52 | |
| 53 | Signature Elements |
| 54 | ------------------ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 55 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 56 | SignatureType |
| 57 | ~~~~~~~~~~~~~ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 58 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 59 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 60 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 61 | SignatureType = SIGNATURE-TYPE-TYPE TLV-LENGTH nonNegativeInteger |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [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 | This specification defines the following SignatureType values: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 65 | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 66 | +---------+----------------------------------------+-------------------------------------------------+ |
| 67 | | Value | Reference | Description | |
| 68 | +=========+========================================+=================================================+ |
| 69 | | 0 | :ref:`DigestSha256` | Integrity protection using SHA-256 digest | |
| 70 | +---------+----------------------------------------+-------------------------------------------------+ |
| 71 | | 1 | :ref:`SignatureSha256WithRsa` | Integrity and provenance protection using | |
| 72 | | | | RSA signature over a SHA-256 digest | |
| 73 | +---------+----------------------------------------+-------------------------------------------------+ |
| 74 | | 3 | :ref:`SignatureSha256WithEcdsa` | Integrity and provenance protection using | |
| 75 | | | | an ECDSA signature over a SHA-256 digest | |
| 76 | +---------+----------------------------------------+-------------------------------------------------+ |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 77 | | 4 | :ref:`SignatureHmacWithSha256` | Integrity and provenance protection using | |
| 78 | | | | SHA256 hash-based message authentication codes | |
| 79 | +---------+----------------------------------------+-------------------------------------------------+ |
| 80 | | 2,5-200 | | reserved for future assignments | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 81 | +---------+----------------------------------------+-------------------------------------------------+ |
| 82 | | >200 | | unassigned | |
| 83 | +---------+----------------------------------------+-------------------------------------------------+ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 84 | |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 85 | .. _KeyLocator: |
| 86 | |
| 87 | KeyLocator |
| 88 | ~~~~~~~~~~ |
| 89 | |
Alexander Afanasyev | 7455e9b | 2014-06-25 09:41:08 -0700 | [diff] [blame] | 90 | A ``KeyLocator`` specifies either ``Name`` that points to another Data packet containing certificate or public key or ``KeyDigest`` to identify the public key within a specific trust model (the trust model definition is outside the scope of the current specification). |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 91 | Note that although ``KeyLocator`` is defined as an optional field in ``SignatureInfo`` block, some signature types may require presence of it and some require ``KeyLocator`` absence. |
| 92 | |
| 93 | :: |
| 94 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 95 | KeyLocator = KEY-LOCATOR-TYPE TLV-LENGTH (Name / KeyDigest) |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 96 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 97 | KeyDigest = KEY-DIGEST-TYPE TLV-LENGTH *OCTET |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 98 | |
| 99 | See :ref:`Name specification <Name>` for the definition of Name field. |
| 100 | |
| 101 | The specific definition of the usage of ``Name`` and ``KeyDigest`` options in ``KeyLocator`` field is outside the scope of this specification. |
| 102 | Generally, ``Name`` names the Data packet with the corresponding certificate. |
| 103 | However, it is up to the specific trust model to define whether this name is a full name of the Data packet or a prefix that can match multiple Data packets. |
| 104 | For example, the hierarchical trust model :cite:`testbed-key-management` uses the latter approach, requiring clients to fetch the latest version of the Data packet pointed by the KeyLocator (the latest version of the public key certificate) in order to ensure that the public key was not yet revoked. |
| 105 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 106 | .. _SignatureInfoNonce: |
| 107 | |
| 108 | SignatureNonce |
| 109 | ~~~~~~~~~~~~~~ |
| 110 | |
| 111 | :: |
| 112 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 113 | SignatureNonce = SIGNATURE-NONCE-TYPE |
| 114 | TLV-LENGTH ; == 4 |
| 115 | 4OCTET |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 116 | |
| 117 | |
| 118 | The ``SignatureNonce`` element adds additional assurances that a signature will be unique. |
| 119 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 120 | .. _SignatureTime: |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 121 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 122 | SignatureTime |
| 123 | ~~~~~~~~~~~~~ |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 124 | |
| 125 | :: |
| 126 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 127 | SignatureTime = SIGNATURE-TIME-TYPE TLV-LENGTH nonNegativeInteger |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 128 | |
| 129 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 130 | The value of the ``SignatureTime`` element is the signature's timestamp (in terms of milliseconds since 1970-01-01 00:00:00 UTC) encoded as nonNegativeInteger. |
| 131 | The ``SignatureTime`` element may be used to protect against replay attacks. |
| 132 | |
| 133 | .. _SignatureSeqNum: |
| 134 | |
| 135 | SignatureSeqNum |
| 136 | ~~~~~~~~~~~~~~~ |
| 137 | |
| 138 | :: |
| 139 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 140 | SignatureSeqNum = SIGNATURE-SEQ-NUM-TYPE TLV-LENGTH nonNegativeInteger |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 141 | |
| 142 | |
| 143 | The ``SignatureSeqNum`` element adds additional assurances that a signature will be unique. |
| 144 | The ``SignatureSeqNum`` may be used to protect against replay attacks. |
| 145 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 146 | |
| 147 | Different Types of Signature |
| 148 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 149 | |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 150 | Each signature type has different requirements on the format of its ``SignatureInfo`` or ``InterestSignatureInfo`` element. |
| 151 | In the following sections, these requirements are specified along 2 dimensions: |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 152 | |
| 153 | * The TLV-VALUE of ``SignatureType`` |
| 154 | * ``KeyLocator`` is required/forbidden |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 155 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 156 | .. _DigestSha256: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 157 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 158 | DigestSha256 |
| 159 | ^^^^^^^^^^^^ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 160 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 161 | ``DigestSha256`` provides no provenance of a Data packet or any kind of guarantee that packet is from the original source. |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 162 | This signature type is intended only for debug purposes and limited circumstances when it is necessary to protect only against unexpected modification during the transmission. |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 163 | |
| 164 | ``DigestSha256`` is defined as a SHA256 hash of the :ref:`Name`, :ref:`MetaInfo`, :ref:`Content`, and :ref:`SignatureInfo <Signature>` TLVs: |
| 165 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 166 | * The TLV-VALUE of ``SignatureType`` is 0 |
| 167 | * ``KeyLocator`` is forbidden; if present, it must be ignored |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 168 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 169 | :: |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 170 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 171 | SignatureValue = SIGNATURE-VALUE-TYPE |
| 172 | TLV-LENGTH ; == 32 |
| 173 | 32OCTET ; == SHA256{Name, MetaInfo, Content, SignatureInfo} |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 174 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 175 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE |
| 176 | TLV-LENGTH ; == 32 |
| 177 | 32OCTET ; == SHA256{Name(without T, L, and ParametersSha256DigestComponent), |
| 178 | ; ApplicationParameters, InterestSignatureInfo} |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 179 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 180 | .. _SignatureSha256WithRsa: |
| 181 | |
| 182 | SignatureSha256WithRsa |
| 183 | ^^^^^^^^^^^^^^^^^^^^^^ |
| 184 | |
| 185 | ``SignatureSha256WithRsa`` is the basic signature algorithm that MUST be supported by any NDN-compliant software. |
| 186 | As suggested by the name, it defines an RSA public key signature that is calculated over SHA256 hash of the :ref:`Name`, :ref:`MetaInfo`, :ref:`Content`, and :ref:`SignatureInfo <Signature>` TLVs. |
| 187 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 188 | * The TLV-VALUE of ``SignatureType`` is 1 |
| 189 | * ``KeyLocator`` is required |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 190 | |
| 191 | :: |
| 192 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 193 | SignatureValue = SIGNATURE-VALUE-TYPE TLV-LENGTH |
| 194 | *OCTET ; == RSA over SHA256{Name, MetaInfo, Content, SignatureInfo} |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 195 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 196 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE TLV-LENGTH |
| 197 | *OCTET ; == RSA over SHA256{Name(without T, L, and ParametersSha256DigestComponent), |
| 198 | ApplicationParameters, InterestSignatureInfo} |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 199 | |
Alexander Afanasyev | 16962fc | 2014-02-12 19:53:47 +0000 | [diff] [blame] | 200 | .. note:: |
| 201 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 202 | The TLV-LENGTH of these elements varies (typically 128 or 256 bytes) depending on the private key length used during the signing process. |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 203 | |
| 204 | This type of signature ensures strict provenance of a Data packet, provided that the signature verifies and signature issuer is authorized to sign the Data packet. |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 205 | The signature issuer is identified using :ref:`KeyLocator` block in :ref:`SignatureInfo <Signature>` block of ``SignatureSha256WithRsa``. |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 206 | KeyDigest option in ``KeyLocator`` is defined as SHA256 digest over the DER encoding of the SubjectPublicKeyInfo for an RSA key as defined by `RFC 3279 <http://www.rfc-editor.org/rfc/rfc3279.txt>`_." |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 207 | See :ref:`KeyLocator section <KeyLocator>` for more detail. |
| 208 | |
| 209 | .. note:: |
| 210 | |
| 211 | It is application's responsibility to define rules (trust model) of when a specific issuer (KeyLocator) is authorized to sign a specific Data packet. |
| 212 | While trust model is outside the scope of the current specification, generally, trust model needs to specify authorization rules between KeyName and Data packet Name, as well as clearly define trust anchor(s). |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 213 | For example, an application can elect to use hierarchical trust model :cite:`testbed-key-management` to ensure Data integrity and provenance. |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 214 | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 215 | .. _SignatureSha256WithEcdsa: |
| 216 | |
| 217 | SignatureSha256WithEcdsa |
| 218 | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 219 | |
| 220 | ``SignatureSha256WithEcdsa`` defines an ECDSA public key signature that is calculated over the SHA256 hash of the :ref:`Name`, :ref:`MetaInfo`, :ref:`Content`, and :ref:`SignatureInfo <Signature>` TLVs. |
| 221 | The signature algorithm is defined in `[RFC5753], Section 2.1 <http://tools.ietf.org/html/rfc5753#section-2.1>`_. |
| 222 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 223 | * The TLV-VALUE of ``SignatureType`` is 3 |
| 224 | * ``KeyLocator`` is required |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 225 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 226 | :: |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 227 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 228 | SignatureValue = SIGNATURE-VALUE-TYPE TLV-LENGTH |
| 229 | *OCTET ; == ECDSA over SHA256{Name, MetaInfo, Content, SignatureInfo} |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 230 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 231 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE TLV-LENGTH |
| 232 | *OCTET ; == ECDSA over SHA256{Name(without T, L, and ParametersSha256DigestComponent), |
| 233 | ApplicationParameters, InterestSignatureInfo} |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 234 | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 235 | .. note:: |
| 236 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 237 | The TLV-LENGTH of these elements depends on the elliptic curve used during the signing process (about 63 bytes for a 224 bit key). |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 238 | |
| 239 | This type of signature ensures strict provenance of a Data packet, provided that the signature verifies and the signature issuer is authorized to sign the Data packet. |
| 240 | The signature issuer is identified using the :ref:`KeyLocator` block in the :ref:`SignatureInfo <Signature>` block of the ``SignatureSha256WithEcdsa``. |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 241 | KeyDigest option in ``KeyLocator`` is defined as SHA256 digest over the DER encoding of the SubjectPublicKeyInfo for an EC key as defined by `RFC 5480 <http://www.ietf.org/rfc/rfc5480.txt>`_. |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 242 | See the :ref:`KeyLocator section <KeyLocator>` for more detail. |
| 243 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 244 | The value of ``SignatureValue`` of ``SignatureSha256WithEcdsa`` is a DER encoded ECDSA signature as defined in `Section 2.2.3 in RFC 3279 <http://tools.ietf.org/html/rfc3279#section-2.2.3>`_. |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 245 | |
| 246 | :: |
| 247 | |
| 248 | Ecdsa-Sig-Value ::= SEQUENCE { |
| 249 | r INTEGER, |
| 250 | s INTEGER } |
| 251 | |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 252 | .. _SignatureHmacWithSha256: |
| 253 | |
| 254 | SignatureHmacWithSha256 |
| 255 | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 256 | |
| 257 | ``SignatureHmacWithSha256`` defines a hash-based message authentication code (HMAC) that is calculated over the :ref:`Name`, :ref:`MetaInfo`, :ref:`Content`, and :ref:`SignatureInfo <Signature>` TLVs, using SHA256 as the hash function, salted with a shared secret key. |
| 258 | The signature algorithm is defined in `Section 2 in RFC 2104 <http://tools.ietf.org/html/rfc2104#section-2>`__. |
| 259 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 260 | * The TLV-VALUE of ``SignatureType`` is 4 |
| 261 | * ``KeyLocator`` is required |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 262 | |
Zhiyi Zhang | 47e5137 | 2019-02-25 13:47:01 -0800 | [diff] [blame] | 263 | :: |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 264 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 265 | SignatureValue = SIGNATURE-VALUE-TYPE |
| 266 | TLV-LENGTH ; == 32 |
| 267 | 32OCTET ; == HMAC{Name, MetaInfo, Content, SignatureInfo} |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 268 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 269 | InterestSignatureValue = INTEREST-SIGNATURE-VALUE-TYPE |
| 270 | TLV-LENGTH ; == 32 |
| 271 | 32OCTET ; == HMAC{Name(without T, L, and ParametersSha256DigestComponent), |
| 272 | ApplicationParameters, InterestSignatureInfo} |
Zhiyi Zhang | 0c04fd8 | 2018-09-04 16:29:47 -0400 | [diff] [blame] | 273 | |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 274 | .. note:: |
| 275 | |
| 276 | The shared secret key is not included in the signature and must not be included anywhere in the data packet, as it would invalidate security properties of HMAC. |
| 277 | |
| 278 | .. note:: |
| 279 | |
| 280 | As stated in `Section 3 of RFC 2104 <http://tools.ietf.org/html/rfc2104#section-3>`__, shared keys shorter than the SHA256 output byte length (32 bytes) are strongly discouraged. |
| 281 | |
| 282 | Provided that the signature verifies, this type of signature ensures provenance that the Data packet was signed by one of the parties who holds the shared key. |
| 283 | The shared key used to generate HMAC signature can be identified by the :ref:`KeyLocator` block in :ref:`SignatureInfo <Signature>`, e.g., by using the ``Name`` according to application's naming conventions. |
| 284 | It is the application's responsibility to establish association between the shared key and the identities of the parties who hold the shared key. |
| 285 | |
Junxiao Shi | 78ce295 | 2019-05-07 15:34:00 -0400 | [diff] [blame] | 286 | .. bibliography:: ndnspec-refs.bib |