blob: f283b7fc9808f6503c2fa5daccfec86167d34bd8 [file] [log] [blame]
Alexander Afanasyevaa8b3782017-01-19 20:04:31 -08001.. _Signed Interest:
2
Eric Newberry6b2cb792020-06-28 13:05:24 -07003Signed Interest Version 0.2 (DEPRECATED)
4========================================
5
6.. warning::
7 This document describes a deprecated format for signed Interest packets. The current format can
8 be found in the
9 `NDN Packet Specification <https://named-data.net/doc/NDN-packet-spec/current/signed-interest.html>`__.
Yingdi Yu4e99f532014-08-25 19:40:57 -070010
11**Signed Interest** is a mechanism to issue an authenticated interest.
12
13The signature of a signed Interest packet is embedded into the last component of the Interest
14name. The signature covers a continuous block starting from the first name component TLV to the
15penultimate name component TLV:
16
17::
18
19 +-------------+----------+-----------------------------------------------------------------------------------+
20 | Interest | Interest | +------+--------+--------------------------------------------------+ +----------+ |
21 | Type (0x01) | length | | Name | Name | +---------+-- --+---------+---------+---------+| | Other | |
22 | | | | Type | Length | |Component| ... |Component|Component|Component|| | TLVs ... | |
23 | | | | | | | TLV 1 | | TLV n-2 | TLV n-1 | TLV n || | in | |
24 | | | | | | +---------+-- --+---------+---------+---------+| | Interest | |
25 | | | +------+--------+--------------------------------------------------+ +----------+ |
26 +-------------+----------+-----------------------------------------------------------------------------------+
27
28 \ /\ /
29 ---------------- ------------------ --- ---
30 \/ \/
31 Signed portion of Interest Signature
32
33More specifically, the SignedInterest is defined to have four additional components:
34
35- ``<timestamp>``
36- ``<nonce>``
37- ``<SignatureInfo>``
38- ``<SignatureValue>``
39
40For example, for ``/signed/interest/name`` name, CommandInterest will be defined as:
41
42::
43
44 /signed/interest/name/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
45
46 \ /
47 ----------------------------- --------------------------
48 \/
49 Additional components of Signed Interest
50
51Signed Interest specific Name components
52----------------------------------------
53
54Timestamp component (n-3 *th*)
55~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56
57The value of the n-3 *th* component is the interest's timestamp (in terms of millisecond offset
58from UTC 1970-01-01 00:00:00) encoded as
Eric Newberry6b2cb792020-06-28 13:05:24 -070059`NonNegativeInteger <https://named-data.net/doc/NDN-packet-spec/0.2.1/tlv.html#non-negative-integer-encoding>`__.
Yingdi Yu4e99f532014-08-25 19:40:57 -070060The timestamp may be used to protect against replay attack.
61
62Nonce component (n-2 *th*)
63~~~~~~~~~~~~~~~~~~~~~~~~~~
64
65The value of the n-2 *th* component is random value (encoded as
Eric Newberry6b2cb792020-06-28 13:05:24 -070066`NonNegativeInteger <https://named-data.net/doc/NDN-packet-spec/0.2.1/tlv.html#non-negative-integer-encoding>`__)
Yingdi Yu4e99f532014-08-25 19:40:57 -070067that adds additional assurances that the interest will be unique.
68
69SignatureInfo component (n-1 *th*)
70~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71
72The value of the n-1 *th* component is actually a
Eric Newberry6b2cb792020-06-28 13:05:24 -070073`SignatureInfo <https://named-data.net/doc/NDN-packet-spec/0.2.1/signature.html>`__ TLV.
Yingdi Yu4e99f532014-08-25 19:40:57 -070074
75::
76
77 +---------+---------+-------------------+
78 |Component|Component| +---------------+ |
79 | Type | Length | | SignatureInfo | |
80 | | | | TLV | |
81 | | | +---------------+ |
82 +---------+---------+-------------------+
83
84 | |
85 |<---------The n-1 th Component-------->|
86
87SignatureValue component (n *th*)
88~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89
90The value of the n *th* component is actually a
Eric Newberry6b2cb792020-06-28 13:05:24 -070091`SignatureValue <https://named-data.net/doc/NDN-packet-spec/0.2.1/signature.html>`__ TLV.
Yingdi Yu4e99f532014-08-25 19:40:57 -070092
93::
94
95 +---------+---------+--------------------+
96 |Component|Component| +----------------+ |
97 | Type | Length | | SignatureValue | |
98 | | | | TLV | |
99 | | | +----------------+ |
100 +---------+---------+--------------------+
101
102 | |
103 |<----------The n th Component---------->|
104
105Signed Interest processing
106--------------------------
107
108On receiving an Interest, the producer, according to the Interest name prefix, should be able
109to tell whether the Interest is required to be signed. If the received Interest is supposed to
110be signed, it will be treated as invalid in the following three cases:
111
112- one of the four components above (Timestamp, Nonce, SignatureValue, and SignatureInfo) is
113 missing or cannot be parsed correctly;
114- the key is not trusted for signing the Interest;
115- the signature cannot be verified with the public key pointed by the
Eric Newberry6b2cb792020-06-28 13:05:24 -0700116 `KeyLocator <https://named-data.net/doc/NDN-packet-spec/0.2.1/signature.html#keylocator>`__ in
Yingdi Yu4e99f532014-08-25 19:40:57 -0700117 SignatureInfo.
118
119Recipients of a signed interest may further check the timestamp and the uniqueness of the
120signed interest (e.g., when the signed interest carries a command). In this case, a signed
121interest may be treated as invalid if :
122
123- a valid signed Interest whose timestamp is **equal or later** than the timestamp of the
124 received one has been received before.
125
126Note that in order to detect this situation, the recipient needs to maintain a *latest
127timestamp* state for each trusted public key (**Since public key cryptography is used, sharing
128private keys is not recommended. If private key sharing is inevitable, it is the key owner's
129responsibility to keep clock synchronized**). For each trusted public key, the state is
130initialized as the timestamp of the first valid Interest signed by the key. Since then, the
131state will be updated every time when the recipient receives a valid signed Interest.
132
133Note that for the first Interest, the state is not available. To handle this special situation,
134the recipient should check the Interest's timestamp against a grace interval (e.g., 120
135seconds) [current\_timestamp - interval/2, current\_timestamp + interval/2]. The first interest
136is invalid if its timestamp is outside of the interval.