Command Interests » History » Version 12
Yingdi Yu, 07/09/2014 02:25 PM
1 | 11 | Yingdi Yu | Command Interests |
---|---|---|---|
2 | ================= |
||
3 | 1 | Yingdi Yu | |
4 | 12 | Yingdi Yu | <font color='red'>**Command Interest** has been deprecated. Please use **[Signed Interest](http://redmine.named-data.net/projects/ndn-cxx/wiki/SignedInterest)** instead.</font> |
5 | |||
6 | **Command Interest** is a mechanism to issue an authenticated control command. |
||
7 | Command Interests are similar to Signed Interests, but in addition to basic cryptographic signature, also ensure uniqueness of each command. |
||
8 | |||
9 | The signature of a command Interest packet is embedded into the last component of the Interest name. |
||
10 | The signature covers a continuous block starting from the first name component TLV to the penultimate name component TLV: |
||
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 | |||
26 | |||
27 | More specifically, the CommandInterest is defined to have three additional components: |
||
28 | |||
29 | * ``<timestamp>`` |
||
30 | * ``<random-value>`` |
||
31 | * ``<SignatureInfo>`` |
||
32 | * ``<SignatureValue>`` |
||
33 | |||
34 | |||
35 | For example, for ``/signed/interest/name`` name, CommandInterest will be defined as: |
||
36 | |||
37 | /signed/interest/name/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue> |
||
38 | \ / |
||
39 | ------------------------- ------------------------------ |
||
40 | \/ |
||
41 | Additional components of Command Interest |
||
42 | |||
43 | |||
44 | ## Signed Interest specific Name components |
||
45 | |||
46 | ### Timestamp component (n-3 *th*) |
||
47 | |||
48 | The value of the n-3 *th* component is the control command's timestamp (in terms of millisecond offset from UTC 1970-01-01 00:00:00) encoded as [nonNegativeInteger](http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding). |
||
49 | The timestamp is used to protect against replay attack. |
||
50 | |||
51 | ### Random value (n-2 *th*) |
||
52 | |||
53 | The value of the n-2 *th* component is random value (encoded as [nonNegativeInteger](http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding)) that adds additional assurances that the command Interest will be unique, even if multiple commands are issued at the same time. |
||
54 | |||
55 | ### SignatureInfo component (n-1 *th*) |
||
56 | |||
57 | The value of the n-1 *th* component is actually a [SignatureInfo](http://named-data.net/doc/ndn-tlv/signature.html) TLV. |
||
58 | |||
59 | +---------+---------+-------------------+ |
||
60 | |Component|Component| +---------------+ | |
||
61 | | Type | Length | | SignatureInfo | | |
||
62 | | | | | TLV | | |
||
63 | | | | +---------------+ | |
||
64 | +---------+---------+-------------------+ |
||
65 | |||
66 | | | |
||
67 | |<---------The n-1 th Component-------->| |
||
68 | |||
69 | ### SignatureValue component (n *th*) |
||
70 | |||
71 | The value of the n *th* component is actually a [SignatureValue](http://named-data.net/doc/ndn-tlv/signature.html) TLV. |
||
72 | |||
73 | +---------+---------+--------------------+ |
||
74 | |Component|Component| +----------------+ | |
||
75 | | Type | Length | | SignatureValue | | |
||
76 | | | | | TLV | | |
||
77 | | | | +----------------+ | |
||
78 | +---------+---------+--------------------+ |
||
79 | |||
80 | | | |
||
81 | |<----------The n th Component---------->| |
||
82 | |||
83 | ## Command Interest processing |
||
84 | |||
85 | On receiving an Interest, the producer, according to the Interest name prefix, should be able to tell whether the Interest is required to be signed. |
||
86 | If the received Interest is supposed to be signed, it will be treated as invalid in the following four cases: |
||
87 | |||
88 | - one of the three components above (SignatureValue, SignatureInfo, and Timestamp) is missing or cannot be parsed correctly; |
||
89 | - the key is not trusted for signing the control command; |
||
90 | - the signature cannot be verified with the public key pointed by the [KeyLocator](http://named-data.net/doc/ndn-tlv/signature.html#keylocator) in SignatureInfo; |
||
91 | - the producer has already received a valid signed Interest whose timestamp is **equal or later** than the timestamp of the received one. |
||
92 | |||
93 | Note that in order to detect the fourth case, the producer needs to maintain a *latest timestamp* state for each trusted public key |
||
94 | (**Since public key cryptography is used, sharing private keys is not recommended. If private key sharing is inevitable, it is the key owner's responsibility to keep clock synchronized**). |
||
95 | For each trusted public key, the state is initialized as the timestamp of the first valid Interest signed by the key. |
||
96 | Since then, the state will be updated every time when the producer receives a valid command Interest. |
||
97 | |||
98 | Note that for the first Interest, the state is not available. |
||
99 | To handle this special situation, the producer should check the Interest's timestamp against a proper interval (e.g., 120 seconds) [current\_timestamp - interval/2, current\_timestamp + interval/2]. |
||
100 | The first interest is invalid if its timestamp is outside of the interval. |