blob: ad9defc4ebb1c07eb2d09954bdbf6d917daf1af6 [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 Afanasyeve2800232013-11-27 02:24:14 +000013::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000014
Alexander Afanasyeve2800232013-11-27 02:24:14 +000015 Signature ::= SignatureInfo
16 SignatureBits
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000017
Alexander Afanasyeve2800232013-11-27 02:24:14 +000018 SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
19 SignatureType
Alexander Afanasyev4b896112014-06-23 21:47:15 -070020 KeyLocator?
Alexander Afanasyeve2800232013-11-27 02:24:14 +000021 ... (SignatureType-specific TLVs)
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000022
Alexander Afanasyev23c2e412014-02-12 19:53:48 +000023 SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH
Jeff Thompsond4225d42014-06-09 12:32:21 -070024 ... (SignatureType-specific TLVs and
Alexander Afanasyeve2800232013-11-27 02:24:14 +000025 BYTE+
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000026
Alexander Afanasyeve2800232013-11-27 02:24:14 +000027SignatureType
28~~~~~~~~~~~~~
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000029
Alexander Afanasyeve2800232013-11-27 02:24:14 +000030::
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000031
Alexander Afanasyeve2800232013-11-27 02:24:14 +000032 SignatureType ::= SIGNATURE-TYPE-TYPE TLV-LENGTH
33 nonNegativeInteger
Jeff Thompsond4225d42014-06-09 12:32:21 -070034
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000035
Alexander Afanasyeve2800232013-11-27 02:24:14 +000036This specification defines the following SignatureType values:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000037
Jeff Thompsond4225d42014-06-09 12:32:21 -070038+---------+----------------------------------------+-------------------------------------------------+
39| Value | Reference | Description |
40+=========+========================================+=================================================+
41| 0 | :ref:`DigestSha256` | Integrity protection using SHA-256 digest |
42+---------+----------------------------------------+-------------------------------------------------+
43| 1 | :ref:`SignatureSha256WithRsa` | Integrity and provenance protection using |
44| | | RSA signature over a SHA-256 digest |
45+---------+----------------------------------------+-------------------------------------------------+
46| 3 | :ref:`SignatureSha256WithEcdsa` | Integrity and provenance protection using |
47| | | an ECDSA signature over a SHA-256 digest |
48+---------+----------------------------------------+-------------------------------------------------+
49| 2,4-200 | | reserved for future assignments |
50+---------+----------------------------------------+-------------------------------------------------+
51| >200 | | unassigned |
52+---------+----------------------------------------+-------------------------------------------------+
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000053
Alexander Afanasyeve2800232013-11-27 02:24:14 +000054.. +-------+----------------------------------------+-------------------------------------------------+
55.. | 2 | :ref:`SignatureSha256WithRsaAndMerkle` | Integrity and provenance protection using |
56.. | | | RSA signature over SHA-256-Merkle-Hash digest. |
57.. | | | |
58.. | | | This signature type defines an aggregated |
59.. | | | signing algorithm that reduces cost of signing |
60.. | | | of a large segmented content (e.g., video file).|
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000061
Alexander Afanasyev4b896112014-06-23 21:47:15 -070062
63.. _KeyLocator:
64
65KeyLocator
66~~~~~~~~~~
67
68A ``KeyLocator`` specifies either a 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).
69Note 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.
70
71::
72
73 KeyLocator ::= KEY-LOCATOR-TYPE TLV-LENGTH (Name | KeyDigest)
74
75 KeyDigest ::= KEY-DIGEST-TYPE TLV-LENGTH BYTE+
76
77See :ref:`Name specification <Name>` for the definition of Name field.
78
79The specific definition of the usage of ``Name`` and ``KeyDigest`` options in ``KeyLocator`` field is outside the scope of this specification.
80Generally, ``Name`` names the Data packet with the corresponding certificate.
81However, 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.
82For 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.
83
Alexander Afanasyeve2800232013-11-27 02:24:14 +000084.. _DigestSha256:
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000085
Alexander Afanasyeve2800232013-11-27 02:24:14 +000086DigestSha256
87^^^^^^^^^^^^
Alexander Afanasyeveee8c252013-11-21 23:22:41 +000088
Alexander Afanasyeve2800232013-11-27 02:24:14 +000089``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 -070090This 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 +000091
92``DigestSha256`` is defined as a SHA256 hash of the :ref:`Name`, :ref:`MetaInfo`, :ref:`Content`, and :ref:`SignatureInfo <Signature>` TLVs:
93
94::
95
96 SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH(=3)
97 SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 0
98
Alexander Afanasyev23c2e412014-02-12 19:53:48 +000099 SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH(=32)
100 BYTE+(=SHA256{Name, MetaInfo, Content, SignatureInfo})
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000101
Alexander Afanasyev4b896112014-06-23 21:47:15 -0700102Note that ``SignatureInfo`` does not require ``KeyLocator`` field, since there digest calculation and verification does not require any additional information.
103If ``KeyLocator`` is present in ``SignatureInfo``, it must be ignored.
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000104
105.. _SignatureSha256WithRsa:
106
107SignatureSha256WithRsa
108^^^^^^^^^^^^^^^^^^^^^^
109
110``SignatureSha256WithRsa`` is the basic signature algorithm that MUST be supported by any NDN-compliant software.
111As 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.
112
113
114::
115
116 SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
117 SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 1
118 KeyLocator
119
Alexander Afanasyev23c2e412014-02-12 19:53:48 +0000120 SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH
121 BYTE+(=RSA over SHA256{Name, MetaInfo, Content, SignatureInfo})
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000122
Alexander Afanasyev16962fc2014-02-12 19:53:47 +0000123.. note::
124
125 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 +0000126
127This 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 -0700128The signature issuer is identified using :ref:`KeyLocator` block in :ref:`SignatureInfo <Signature>` block of ``SignatureSha256WithRsa``.
Alexander Afanasyev4b896112014-06-23 21:47:15 -0700129KeyDigest 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 +0000130See :ref:`KeyLocator section <KeyLocator>` for more detail.
131
132.. note::
133
134 It is application's responsibility to define rules (trust model) of when a specific issuer (KeyLocator) is authorized to sign a specific Data packet.
135 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 -0700136 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 +0000137
Jeff Thompsond4225d42014-06-09 12:32:21 -0700138.. _SignatureSha256WithEcdsa:
139
140SignatureSha256WithEcdsa
141^^^^^^^^^^^^^^^^^^^^^^^^
142
143``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.
144The signature algorithm is defined in `[RFC5753], Section 2.1 <http://tools.ietf.org/html/rfc5753#section-2.1>`_.
145
146::
147
148 SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
149 SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 3
150 KeyLocator
151
152 SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH
153 BYTE+(=ECDSA over SHA256{Name, MetaInfo, Content, SignatureInfo})
154
155.. note::
156
157 The SignatureValue size depends on the private key length used during the signing process (about 63 bytes for a 224 bit key).
158
159This 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.
160The 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 -0700161KeyDigest 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 -0700162See the :ref:`KeyLocator section <KeyLocator>` for more detail.
163
164The 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>`_.
165
166::
167
168 Ecdsa-Sig-Value ::= SEQUENCE {
169 r INTEGER,
170 s INTEGER }
171
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000172.. .. _SignatureSha256WithRsaAndMerkle:
173
174.. SignatureSha256WithRsaAndMerkle
175.. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
176
177.. ::
178
179.. SignatureInfo ::= SIGNATURE-INFO-TYPE TLV-LENGTH
180.. SIGNATURE-TYPE-TYPE TLV-LENGTH(=1) 2
181.. KeyLocator
182
Alexander Afanasyev23c2e412014-02-12 19:53:48 +0000183.. SignatureValue ::= SIGNATURE-VALUE-TYPE TLV-LENGTH
184.. BYTE+(=RSA over SHA256{Name, MetaInfo, Content, SignatureInfo})
Alexander Afanasyeve2800232013-11-27 02:24:14 +0000185.. Witness
186
187.. Witness ::= WITNESS-TYPE TLV-LENGTH BYTE+
188
Alexander Afanasyev4b896112014-06-23 21:47:15 -0700189.. bibliography:: ndnspec-refs.bib