blob: 0a7f96b53a28386e3c485f0513afbf034425e427 [file] [log] [blame]
Alexander Afanasyeve2800232013-11-27 02:24:14 +00001.. _Signature:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +00002
3Signature
4---------
5
Alexander Afanasyeve2800232013-11-27 02:24:14 +00006NDN Signature is defined as two consecutive TLV blocks: ``SignatureInfo`` and ``SignatureValue``.
7The following general considerations about SignatureInfo and SignatureValue blocks that apply for all signature types:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +00008
Alexander Afanasyeve2800232013-11-27 02:24:14 +000091. ``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 Afanasyeveee8c252013-11-21 23:22:41 +000010
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000112. ``SignatureValue`` is **excluded** from signature calculation and represent actual bits of the signature and any other supporting signature material.
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000012
Alexander Afanasyev7455e9b2014-06-25 09:41:08 -070013The 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 Afanasyeve2800232013-11-27 02:24:14 +000015::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000016
Alexander Afanasyeve2800232013-11-27 02:24:14 +000017 Signature ::= SignatureInfo
Alexander Afanasyev9e0791a2015-06-12 19:00:31 -070018 SignatureValue
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000019
Alexander Afanasyeve2800232013-11-27 02:24:14 +000020 SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
21 SignatureType
Alexander Afanasyev4b896112014-06-23 21:47:15 -070022 KeyLocator?
Alexander Afanasyeve2800232013-11-27 02:24:14 +000023 ... (SignatureType-specific TLVs)
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000024
Alexander Afanasyev23c2e412014-02-12 19:53:48 +000025 SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH
Jeff Thompsond4225d42014-06-09 12:32:21 -070026 ... (SignatureType-specific TLVs and
Alexander Afanasyeve2800232013-11-27 02:24:14 +000027 BYTE+
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000028
Alexander Afanasyeve2800232013-11-27 02:24:14 +000029SignatureType
30~~~~~~~~~~~~~
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000031
Alexander Afanasyeve2800232013-11-27 02:24:14 +000032::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000033
Alexander Afanasyeve2800232013-11-27 02:24:14 +000034 SignatureType ::= SIGNATURE-TYPE-TYPE TLV-LENGTH
35 nonNegativeInteger
Jeff Thompsond4225d42014-06-09 12:32:21 -070036
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000037
Alexander Afanasyeve2800232013-11-27 02:24:14 +000038This specification defines the following SignatureType values:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000039
Jeff Thompsond4225d42014-06-09 12:32:21 -070040+---------+----------------------------------------+-------------------------------------------------+
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 Thompson29840e82015-04-06 15:21:21 -070051| 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 Thompsond4225d42014-06-09 12:32:21 -070055+---------+----------------------------------------+-------------------------------------------------+
56| >200 | | unassigned |
57+---------+----------------------------------------+-------------------------------------------------+
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000058
Alexander Afanasyeve2800232013-11-27 02:24:14 +000059.. +-------+----------------------------------------+-------------------------------------------------+
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 Afanasyeveee8c252013-11-21 23:22:41 +000066
Alexander Afanasyev4b896112014-06-23 21:47:15 -070067
68.. _KeyLocator:
69
70KeyLocator
71~~~~~~~~~~
72
Alexander Afanasyev7455e9b2014-06-25 09:41:08 -070073A ``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 Afanasyev4b896112014-06-23 21:47:15 -070074Note 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
82See :ref:`Name specification <Name>` for the definition of Name field.
83
84The specific definition of the usage of ``Name`` and ``KeyDigest`` options in ``KeyLocator`` field is outside the scope of this specification.
85Generally, ``Name`` names the Data packet with the corresponding certificate.
86However, 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.
87For 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 Afanasyeve2800232013-11-27 02:24:14 +000089.. _DigestSha256:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000090
Alexander Afanasyeve2800232013-11-27 02:24:14 +000091DigestSha256
92^^^^^^^^^^^^
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000093
Alexander Afanasyeve2800232013-11-27 02:24:14 +000094``DigestSha256`` provides no provenance of a Data packet or any kind of guarantee that packet is from the original source.
Alexander Afanasyev4b896112014-06-23 21:47:15 -070095This 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 Afanasyeve2800232013-11-27 02:24:14 +000096
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 Afanasyev23c2e412014-02-12 19:53:48 +0000104 SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH(=32)
105 BYTE+(=SHA256{Name, MetaInfo, Content, SignatureInfo})
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000106
Alexander Afanasyev4b896112014-06-23 21:47:15 -0700107Note that ``SignatureInfo`` does not require ``KeyLocator`` field, since there digest calculation and verification does not require any additional information.
108If ``KeyLocator`` is present in ``SignatureInfo``, it must be ignored.
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000109
110.. _SignatureSha256WithRsa:
111
112SignatureSha256WithRsa
113^^^^^^^^^^^^^^^^^^^^^^
114
115``SignatureSha256WithRsa`` is the basic signature algorithm that MUST be supported by any NDN-compliant software.
116As 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 Afanasyev23c2e412014-02-12 19:53:48 +0000125 SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH
126 BYTE+(=RSA over SHA256{Name, MetaInfo, Content, SignatureInfo})
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000127
Alexander Afanasyev16962fc2014-02-12 19:53:47 +0000128.. note::
129
130 SignatureValue size varies (typically 128 or 256 bytes) depending on the private key length used during the signing process.
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000131
132This 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 Thompsond4225d42014-06-09 12:32:21 -0700133The signature issuer is identified using :ref:`KeyLocator` block in :ref:`SignatureInfo <Signature>` block of ``SignatureSha256WithRsa``.
Alexander Afanasyev4b896112014-06-23 21:47:15 -0700134KeyDigest 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 Afanasyeve2800232013-11-27 02:24:14 +0000135See :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 Thompsond4225d42014-06-09 12:32:21 -0700141 For example, an application can elect to use hierarchical trust model :cite:`testbed-key-management` to ensure Data integrity and provenance.
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000142
Jeff Thompsond4225d42014-06-09 12:32:21 -0700143.. _SignatureSha256WithEcdsa:
144
145SignatureSha256WithEcdsa
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.
149The 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
164This 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.
165The signature issuer is identified using the :ref:`KeyLocator` block in the :ref:`SignatureInfo <Signature>` block of the ``SignatureSha256WithEcdsa``.
Alexander Afanasyev4b896112014-06-23 21:47:15 -0700166KeyDigest 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 Thompsond4225d42014-06-09 12:32:21 -0700167See the :ref:`KeyLocator section <KeyLocator>` for more detail.
168
169The 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 Thompson29840e82015-04-06 15:21:21 -0700177.. _SignatureHmacWithSha256:
178
179SignatureHmacWithSha256
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.
183The 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
202Provided 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.
203The 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.
204It 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 Afanasyeve2800232013-11-27 02:24:14 +0000206.. .. _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 Afanasyev23c2e412014-02-12 19:53:48 +0000217.. SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH
218.. BYTE+(=RSA over SHA256{Name, MetaInfo, Content, SignatureInfo})
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000219.. Witness
220
221.. Witness ::= WITNESS-TYPE TLV-LENGTH BYTE+
222
Alexander Afanasyev4b896112014-06-23 21:47:15 -0700223.. bibliography:: ndnspec-refs.bib