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