Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 1 | .. _Signature: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 2 | |
| 3 | Signature |
| 4 | --------- |
| 5 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 6 | NDN Signature is defined as two consecutive TLV blocks: ``SignatureInfo`` and ``SignatureValue``. |
| 7 | 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] | 8 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 9 | 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] | 10 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 11 | 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] | 12 | |
Alexander Afanasyev | 7455e9b | 2014-06-25 09:41:08 -0700 | [diff] [blame] | 13 | 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). |
| 14 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 15 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 16 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 17 | Signature ::= SignatureInfo |
Alexander Afanasyev | 9e0791a | 2015-06-12 19:00:31 -0700 | [diff] [blame] | 18 | SignatureValue |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 19 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 20 | SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH |
| 21 | SignatureType |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 22 | KeyLocator? |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 23 | ... (SignatureType-specific TLVs) |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 24 | |
Alexander Afanasyev | 23c2e41 | 2014-02-12 19:53:48 +0000 | [diff] [blame] | 25 | SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 26 | ... (SignatureType-specific TLVs and |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 27 | BYTE+ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 28 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 29 | SignatureType |
| 30 | ~~~~~~~~~~~~~ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 31 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 32 | :: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 33 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 34 | SignatureType ::= SIGNATURE-TYPE-TYPE TLV-LENGTH |
| 35 | nonNegativeInteger |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 36 | |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 37 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 38 | This specification defines the following SignatureType values: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 39 | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 40 | +---------+----------------------------------------+-------------------------------------------------+ |
| 41 | | Value | Reference | Description | |
| 42 | +=========+========================================+=================================================+ |
| 43 | | 0 | :ref:`DigestSha256` | Integrity protection using SHA-256 digest | |
| 44 | +---------+----------------------------------------+-------------------------------------------------+ |
| 45 | | 1 | :ref:`SignatureSha256WithRsa` | Integrity and provenance protection using | |
| 46 | | | | RSA signature over a SHA-256 digest | |
| 47 | +---------+----------------------------------------+-------------------------------------------------+ |
| 48 | | 3 | :ref:`SignatureSha256WithEcdsa` | Integrity and provenance protection using | |
| 49 | | | | an ECDSA signature over a SHA-256 digest | |
| 50 | +---------+----------------------------------------+-------------------------------------------------+ |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 51 | | 4 | :ref:`SignatureHmacWithSha256` | Integrity and provenance protection using | |
| 52 | | | | SHA256 hash-based message authentication codes | |
| 53 | +---------+----------------------------------------+-------------------------------------------------+ |
| 54 | | 2,5-200 | | reserved for future assignments | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 55 | +---------+----------------------------------------+-------------------------------------------------+ |
| 56 | | >200 | | unassigned | |
| 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 | .. +-------+----------------------------------------+-------------------------------------------------+ |
| 60 | .. | 2 | :ref:`SignatureSha256WithRsaAndMerkle` | Integrity and provenance protection using | |
| 61 | .. | | | RSA signature over SHA-256-Merkle-Hash digest. | |
| 62 | .. | | | | |
| 63 | .. | | | This signature type defines an aggregated | |
| 64 | .. | | | signing algorithm that reduces cost of signing | |
| 65 | .. | | | of a large segmented content (e.g., video file).| |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 66 | |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 67 | |
| 68 | .. _KeyLocator: |
| 69 | |
| 70 | KeyLocator |
| 71 | ~~~~~~~~~~ |
| 72 | |
Alexander Afanasyev | 7455e9b | 2014-06-25 09:41:08 -0700 | [diff] [blame] | 73 | 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] | 74 | 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. |
| 75 | |
| 76 | :: |
| 77 | |
| 78 | KeyLocator ::= KEY-LOCATOR-TYPE TLV-LENGTH (Name | KeyDigest) |
| 79 | |
| 80 | KeyDigest ::= KEY-DIGEST-TYPE TLV-LENGTH BYTE+ |
| 81 | |
| 82 | See :ref:`Name specification <Name>` for the definition of Name field. |
| 83 | |
| 84 | The specific definition of the usage of ``Name`` and ``KeyDigest`` options in ``KeyLocator`` field is outside the scope of this specification. |
| 85 | Generally, ``Name`` names the Data packet with the corresponding certificate. |
| 86 | 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. |
| 87 | 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. |
| 88 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 89 | .. _DigestSha256: |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 90 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 91 | DigestSha256 |
| 92 | ^^^^^^^^^^^^ |
Alexander Afanasyev | eee8c25 | 2013-11-21 23:22:41 +0000 | [diff] [blame] | 93 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 94 | ``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] | 95 | 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] | 96 | |
| 97 | ``DigestSha256`` is defined as a SHA256 hash of the :ref:`Name`, :ref:`MetaInfo`, :ref:`Content`, and :ref:`SignatureInfo <Signature>` TLVs: |
| 98 | |
| 99 | :: |
| 100 | |
| 101 | SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH(=3) |
| 102 | SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 0 |
| 103 | |
Alexander Afanasyev | 23c2e41 | 2014-02-12 19:53:48 +0000 | [diff] [blame] | 104 | SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH(=32) |
| 105 | BYTE+(=SHA256{Name, MetaInfo, Content, SignatureInfo}) |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 106 | |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 107 | Note that ``SignatureInfo`` does not require ``KeyLocator`` field, since there digest calculation and verification does not require any additional information. |
| 108 | If ``KeyLocator`` is present in ``SignatureInfo``, it must be ignored. |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 109 | |
| 110 | .. _SignatureSha256WithRsa: |
| 111 | |
| 112 | SignatureSha256WithRsa |
| 113 | ^^^^^^^^^^^^^^^^^^^^^^ |
| 114 | |
| 115 | ``SignatureSha256WithRsa`` is the basic signature algorithm that MUST be supported by any NDN-compliant software. |
| 116 | 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. |
| 117 | |
| 118 | |
| 119 | :: |
| 120 | |
| 121 | SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH |
| 122 | SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 1 |
| 123 | KeyLocator |
| 124 | |
Alexander Afanasyev | 23c2e41 | 2014-02-12 19:53:48 +0000 | [diff] [blame] | 125 | SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH |
| 126 | BYTE+(=RSA over SHA256{Name, MetaInfo, Content, SignatureInfo}) |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 127 | |
Alexander Afanasyev | 16962fc | 2014-02-12 19:53:47 +0000 | [diff] [blame] | 128 | .. note:: |
| 129 | |
| 130 | SignatureValue size 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] | 131 | |
| 132 | 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] | 133 | 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] | 134 | 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] | 135 | See :ref:`KeyLocator section <KeyLocator>` for more detail. |
| 136 | |
| 137 | .. note:: |
| 138 | |
| 139 | It is application's responsibility to define rules (trust model) of when a specific issuer (KeyLocator) is authorized to sign a specific Data packet. |
| 140 | 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] | 141 | 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] | 142 | |
Jeff Thompson | d4225d4 | 2014-06-09 12:32:21 -0700 | [diff] [blame] | 143 | .. _SignatureSha256WithEcdsa: |
| 144 | |
| 145 | SignatureSha256WithEcdsa |
| 146 | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 147 | |
| 148 | ``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. |
| 149 | The signature algorithm is defined in `[RFC5753], Section 2.1 <http://tools.ietf.org/html/rfc5753#section-2.1>`_. |
| 150 | |
| 151 | :: |
| 152 | |
| 153 | SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH |
| 154 | SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 3 |
| 155 | KeyLocator |
| 156 | |
| 157 | SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH |
| 158 | BYTE+(=ECDSA over SHA256{Name, MetaInfo, Content, SignatureInfo}) |
| 159 | |
| 160 | .. note:: |
| 161 | |
| 162 | The SignatureValue size depends on the private key length used during the signing process (about 63 bytes for a 224 bit key). |
| 163 | |
| 164 | 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. |
| 165 | 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] | 166 | 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] | 167 | See the :ref:`KeyLocator section <KeyLocator>` for more detail. |
| 168 | |
| 169 | The value of ``SignatureValue`` of ``SignatureSha256WithEcdsa`` is a DER encoded DSA signature as defined in `Section 2.2.3 in RFC 3279 <http://tools.ietf.org/html/rfc3279#section-2.2.3>`_. |
| 170 | |
| 171 | :: |
| 172 | |
| 173 | Ecdsa-Sig-Value ::= SEQUENCE { |
| 174 | r INTEGER, |
| 175 | s INTEGER } |
| 176 | |
Jeff Thompson | 29840e8 | 2015-04-06 15:21:21 -0700 | [diff] [blame] | 177 | .. _SignatureHmacWithSha256: |
| 178 | |
| 179 | SignatureHmacWithSha256 |
| 180 | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 181 | |
| 182 | ``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. |
| 183 | The signature algorithm is defined in `Section 2 in RFC 2104 <http://tools.ietf.org/html/rfc2104#section-2>`__. |
| 184 | |
| 185 | :: |
| 186 | |
| 187 | SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH |
| 188 | SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 4 |
| 189 | KeyLocator |
| 190 | |
| 191 | SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH(=32) |
| 192 | BYTE+(=HMAC{Name, MetaInfo, Content, SignatureInfo}) |
| 193 | |
| 194 | .. note:: |
| 195 | |
| 196 | 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. |
| 197 | |
| 198 | .. note:: |
| 199 | |
| 200 | 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. |
| 201 | |
| 202 | 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. |
| 203 | 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. |
| 204 | It is the application's responsibility to establish association between the shared key and the identities of the parties who hold the shared key. |
| 205 | |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 206 | .. .. _SignatureSha256WithRsaAndMerkle: |
| 207 | |
| 208 | .. SignatureSha256WithRsaAndMerkle |
| 209 | .. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 210 | |
| 211 | .. :: |
| 212 | |
| 213 | .. SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH |
| 214 | .. SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 2 |
| 215 | .. KeyLocator |
| 216 | |
Alexander Afanasyev | 23c2e41 | 2014-02-12 19:53:48 +0000 | [diff] [blame] | 217 | .. SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH |
| 218 | .. BYTE+(=RSA over SHA256{Name, MetaInfo, Content, SignatureInfo}) |
Alexander Afanasyev | e280023 | 2013-11-27 02:24:14 +0000 | [diff] [blame] | 219 | .. Witness |
| 220 | |
| 221 | .. Witness ::= WITNESS-TYPE TLV-LENGTH BYTE+ |
| 222 | |
Alexander Afanasyev | 4b89611 | 2014-06-23 21:47:15 -0700 | [diff] [blame] | 223 | .. bibliography:: ndnspec-refs.bib |