blob: 47cf123d68e6daf41e84f2f04391e18343ca9617 [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
18 SignatureBits
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+---------+----------------------------------------+-------------------------------------------------+
51| 2,4-200 | | reserved for future assignments |
52+---------+----------------------------------------+-------------------------------------------------+
53| >200 | | unassigned |
54+---------+----------------------------------------+-------------------------------------------------+
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000055
Alexander Afanasyeve2800232013-11-27 02:24:14 +000056.. +-------+----------------------------------------+-------------------------------------------------+
57.. | 2 | :ref:`SignatureSha256WithRsaAndMerkle` | Integrity and provenance protection using |
58.. | | | RSA signature over SHA-256-Merkle-Hash digest. |
59.. | | | |
60.. | | | This signature type defines an aggregated |
61.. | | | signing algorithm that reduces cost of signing |
62.. | | | of a large segmented content (e.g., video file).|
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000063
Alexander Afanasyev4b896112014-06-23 21:47:15 -070064
65.. _KeyLocator:
66
67KeyLocator
68~~~~~~~~~~
69
Alexander Afanasyev7455e9b2014-06-25 09:41:08 -070070A ``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 -070071Note 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.
72
73::
74
75 KeyLocator ::= KEY-LOCATOR-TYPE TLV-LENGTH (Name | KeyDigest)
76
77 KeyDigest ::= KEY-DIGEST-TYPE TLV-LENGTH BYTE+
78
79See :ref:`Name specification <Name>` for the definition of Name field.
80
81The specific definition of the usage of ``Name`` and ``KeyDigest`` options in ``KeyLocator`` field is outside the scope of this specification.
82Generally, ``Name`` names the Data packet with the corresponding certificate.
83However, 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.
84For 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.
85
Alexander Afanasyeve2800232013-11-27 02:24:14 +000086.. _DigestSha256:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000087
Alexander Afanasyeve2800232013-11-27 02:24:14 +000088DigestSha256
89^^^^^^^^^^^^
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000090
Alexander Afanasyeve2800232013-11-27 02:24:14 +000091``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 -070092This 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 +000093
94``DigestSha256`` is defined as a SHA256 hash of the :ref:`Name`, :ref:`MetaInfo`, :ref:`Content`, and :ref:`SignatureInfo <Signature>` TLVs:
95
96::
97
98 SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH(=3)
99 SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 0
100
Alexander Afanasyev23c2e412014-02-12 19:53:48 +0000101 SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH(=32)
102 BYTE+(=SHA256{Name, MetaInfo, Content, SignatureInfo})
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000103
Alexander Afanasyev4b896112014-06-23 21:47:15 -0700104Note that ``SignatureInfo`` does not require ``KeyLocator`` field, since there digest calculation and verification does not require any additional information.
105If ``KeyLocator`` is present in ``SignatureInfo``, it must be ignored.
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000106
107.. _SignatureSha256WithRsa:
108
109SignatureSha256WithRsa
110^^^^^^^^^^^^^^^^^^^^^^
111
112``SignatureSha256WithRsa`` is the basic signature algorithm that MUST be supported by any NDN-compliant software.
113As 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.
114
115
116::
117
118 SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
119 SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 1
120 KeyLocator
121
Alexander Afanasyev23c2e412014-02-12 19:53:48 +0000122 SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH
123 BYTE+(=RSA over SHA256{Name, MetaInfo, Content, SignatureInfo})
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000124
Alexander Afanasyev16962fc2014-02-12 19:53:47 +0000125.. note::
126
127 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 +0000128
129This 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 -0700130The signature issuer is identified using :ref:`KeyLocator` block in :ref:`SignatureInfo <Signature>` block of ``SignatureSha256WithRsa``.
Alexander Afanasyev4b896112014-06-23 21:47:15 -0700131KeyDigest 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 +0000132See :ref:`KeyLocator section <KeyLocator>` for more detail.
133
134.. note::
135
136 It is application's responsibility to define rules (trust model) of when a specific issuer (KeyLocator) is authorized to sign a specific Data packet.
137 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 -0700138 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 +0000139
Jeff Thompsond4225d42014-06-09 12:32:21 -0700140.. _SignatureSha256WithEcdsa:
141
142SignatureSha256WithEcdsa
143^^^^^^^^^^^^^^^^^^^^^^^^
144
145``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.
146The signature algorithm is defined in `[RFC5753], Section 2.1 <http://tools.ietf.org/html/rfc5753#section-2.1>`_.
147
148::
149
150 SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
151 SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 3
152 KeyLocator
153
154 SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH
155 BYTE+(=ECDSA over SHA256{Name, MetaInfo, Content, SignatureInfo})
156
157.. note::
158
159 The SignatureValue size depends on the private key length used during the signing process (about 63 bytes for a 224 bit key).
160
161This 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.
162The 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 -0700163KeyDigest 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 -0700164See the :ref:`KeyLocator section <KeyLocator>` for more detail.
165
166The 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>`_.
167
168::
169
170 Ecdsa-Sig-Value ::= SEQUENCE {
171 r INTEGER,
172 s INTEGER }
173
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000174.. .. _SignatureSha256WithRsaAndMerkle:
175
176.. SignatureSha256WithRsaAndMerkle
177.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
178
179.. ::
180
181.. SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
182.. SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 2
183.. KeyLocator
184
Alexander Afanasyev23c2e412014-02-12 19:53:48 +0000185.. SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH
186.. BYTE+(=RSA over SHA256{Name, MetaInfo, Content, SignatureInfo})
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000187.. Witness
188
189.. Witness ::= WITNESS-TYPE TLV-LENGTH BYTE+
190
Alexander Afanasyev4b896112014-06-23 21:47:15 -0700191.. bibliography:: ndnspec-refs.bib