blob: 2d2dcf38044c0162504265f8e7ee847d458747ac [file] [log] [blame]
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -04001.. _Signed Interest:
2
3Signed Interest
4===============
5
6**Signed Interest** is a mechanism to issue an authenticated Interest.
7
Junxiao Shi78ce2952019-05-07 15:34:00 -04008A signed Interest is an Interest where:
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -04009
Junxiao Shi78ce2952019-05-07 15:34:00 -040010* Name ends with ``ParametersSha256DigestComponent``.
11* ``InterestSignature`` is present.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040012
Davide Pesaventoec288fe2022-11-26 18:28:01 -050013See :ref:`InterestSignature` for details on the format of the ``InterestSignature`` element.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040014
Davide Pesaventoec288fe2022-11-26 18:28:01 -050015Construction of Signed Interests
16--------------------------------
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040017
18The following procedure describes the signing of an Interest:
19
Davide Pesaventoec288fe2022-11-26 18:28:01 -050020#. Remove all ``ParametersSha256DigestComponent`` components from ``Name`` if present, regardless of the location.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040021
Davide Pesaventoec288fe2022-11-26 18:28:01 -050022#. If ``ApplicationParameters`` element is absent, append a zero-length ``ApplicationParameters`` element to the Interest.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040023
Davide Pesaventoec288fe2022-11-26 18:28:01 -050024#. Prepare an ``InterestSignatureInfo`` element and append it at the end of the Interest.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040025
Davide Pesaventoec288fe2022-11-26 18:28:01 -050026#. Compute the cryptographic signature according to the :ref:`InterestSignature` section.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040027
Davide Pesaventoec288fe2022-11-26 18:28:01 -050028#. Insert the computed signature as an ``InterestSignatureValue`` element at the end of the Interest.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040029
Davide Pesaventoec288fe2022-11-26 18:28:01 -050030#. Compute the ``ParametersSha256DigestComponent`` according to the :ref:`ParametersDigestComponent` section and append it at the end of ``Name``.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040031
Davide Pesaventoec288fe2022-11-26 18:28:01 -050032Processing of Signed Interests
33------------------------------
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040034
35Upon receiving an Interest, the producer, according to the Interest name prefix, should be able to tell whether the Interest is required to be signed.
Davide Pesaventoec288fe2022-11-26 18:28:01 -050036If the received Interest is required to be signed, the application protocol or the producer should also explicitly define whether ``SignatureNonce``, ``SignatureTime``, and/or ``SignatureSeqNum`` must be present in ``InterestSignatureInfo`` or not.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040037If any of the required elements is missing, treat the Interest as invalid.
38Additionally, a signed Interest must be treated as invalid if any of the following conditions is true:
39
Davide Pesaventoec288fe2022-11-26 18:28:01 -050040#. The last name component is not ``ParametersSha256DigestComponent``, or its TLV-VALUE is incorrect according to the :ref:`ParametersDigestComponent` section.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040041
Davide Pesaventoec288fe2022-11-26 18:28:01 -050042#. The ``InterestSignatureInfo`` element is missing or any mandatory sub-element is missing from the ``InterestSignatureInfo`` element.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040043
Davide Pesaventoec288fe2022-11-26 18:28:01 -050044#. The ``InterestSignatureValue`` element is missing.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040045
Davide Pesaventoec288fe2022-11-26 18:28:01 -050046#. The signature cannot be cryptographically verified.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040047
Davide Pesaventoec288fe2022-11-26 18:28:01 -050048#. The key used to create the signature is not trusted for signing the Interest.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040049
Davide Pesaventoec288fe2022-11-26 18:28:01 -050050#. If ``SignatureTime`` (*t*) is present in the ``InterestSignatureInfo``:
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040051
Davide Pesaventoec288fe2022-11-26 18:28:01 -050052 Lookup the last recorded ``SignatureTime`` (*t*\ :sub:`0`) used in conjunction with the same key.
53 Use ``CurrentTime - GracePeriod`` if no previous record exists. The recommended grace period is 60 seconds.
54 If *t*\ :sub:`0` >= *t*, consider the Interest as invalid.
55 Set *t*\ :sub:`0` to *t* if the signed Interest has been validated according to this and all other rules.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040056
Davide Pesavento23e340c2021-12-03 04:52:22 -050057 .. note::
58 Sharing private keys is not recommended. If private key sharing is inevitable, it is the key owner's responsibility to keep clocks synchronized.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040059
Davide Pesaventoec288fe2022-11-26 18:28:01 -050060#. If ``SignatureNonce`` is present:
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040061
62 To perform this check, the recipient must remember a list of ``SignatureNonce`` carried in previously received Signed Interests used in conjunction with the specific signing key.
63 Check whether the ``SignatureNonce`` carried in the current signed Interest is a repetition of a recorded ``SignatureNonce`` used with the same key.
64 If it is a repetition, treat the Interest as invalid.
65 Add the newly received ``SignatureNonce`` into the ``SignatureNonce`` list if the signed Interest has been validated according to this and all other rules.
66
Davide Pesavento23e340c2021-12-03 04:52:22 -050067 .. note::
68 The size of the ``SignatureNonce`` list and the lifetime of each ``SignatureNonce`` remembered by the receiver depend on the application protocol's need.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040069
Davide Pesaventoec288fe2022-11-26 18:28:01 -050070#. If ``SignatureSeqNum`` (*s*) is present:
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040071
Davide Pesaventoec288fe2022-11-26 18:28:01 -050072 Lookup the last recorded ``SignatureSeqNum`` (*s*\ :sub:`0`) used in conjunction with the same key.
73 If *s*\ :sub:`0` >= *s*, consider the Interest as invalid.
74 If no previous record exists, check *s* against the application policy.
75 If *s* does not satisfy the application policy, treat the signed Interest as invalid.
76 Set *s*\ :sub:`0` to *s* if the signed Interest has been validated according to this and all other rules.
Zhiyi Zhang0c04fd82018-09-04 16:29:47 -040077
Davide Pesavento23e340c2021-12-03 04:52:22 -050078 .. note::
Davide Pesaventoec288fe2022-11-26 18:28:01 -050079 The first ``SignatureSeqNum`` received is considered valid only if it satisfies the application's policy.
80 For example, application can decide the first ``SeqNum`` can only be a minimum value like 0 or 1, or a value that both sender and receiver agree on.