Command Interests » History » Version 2
Yingdi Yu, 02/10/2014 04:33 PM
1 | 1 | Yingdi Yu | Command Interests |
---|---|---|---|
2 | ================= |
||
3 | |||
4 | **Command Interest** is a mechanism to issue an authenticated control command. |
||
5 | Command Interests are similar to Signed Interests, but in addition to basic cryptographic signature, also ensure uniqueness of each command. |
||
6 | |||
7 | The signature of a command Interest packet is embedded into the last component of the Interest name. |
||
8 | The signature covers a continuous block starting from the first name component TLV to the penultimate name component TLV: |
||
9 | |||
10 | +-------------+----------+-----------------------------------------------------------------------------------+ |
||
11 | | Interest | Interest | +------+--------+--------------------------------------------------+ +----------+ | |
||
12 | | Type (0x01) | length | | Name | Name | +---------+-- --+---------+---------+---------+| | Other | | |
||
13 | | | | | Type | Length | |Component| ... |Component|Component|Component|| | TLVs ... | | |
||
14 | | | | | | | | TLV 1 | | TLV n-2 | TLV n-1 | TLV n || | in | | |
||
15 | | | | | | | +---------+-- --+---------+---------+---------+| | Interest | | |
||
16 | | | | +------+--------+--------------------------------------------------+ +----------+ | |
||
17 | +-------------+----------+-----------------------------------------------------------------------------------+ |
||
18 | |||
19 | \ /\ / |
||
20 | ---------------- ------------------ --- --- |
||
21 | \/ \/ |
||
22 | Signed portion of Interest Signature |
||
23 | |||
24 | |||
25 | More specifically, the CommandInterest is defined to have three additional components: |
||
26 | |||
27 | * ``<timestamp>`` |
||
28 | * ``<random-value>`` |
||
29 | * ``<SignatureInfo>`` |
||
30 | * ``<SignatureValue>`` |
||
31 | |||
32 | For example, for ``/signed/interest/name`` name, CommandInterest will be defined as: |
||
33 | |||
34 | /signed/interest/name/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue> |
||
35 | |||
36 | \ / |
||
37 | ---------------------------- -------------------------------- |
||
38 | \/ |
||
39 | Signed part of the name |
||
40 | |||
41 | ## Signed Interest specific Name components |
||
42 | |||
43 | ### Timestamp component (n-3 *th*) |
||
44 | |||
45 | 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). |
||
46 | The timestamp is used to protect against replay attack. |
||
47 | |||
48 | ### Random value (n-2 *th*) |
||
49 | |||
50 | 2 | Yingdi Yu | The value of the n-2 *th* component is random value (32bits) that adds additional assurances that the command Interest will be unique, even if multiple commands are issued at the same time. |
51 | The random value is also encoded as [nonNegativeInteger](http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding). |
||
52 | 1 | Yingdi Yu | |
53 | ### SignatureInfo component (n-1 *th*) |
||
54 | |||
55 | The value of the n-1 *th* component is actually a [SignatureInfo](http://named-data.net/doc/ndn-tlv/signature.html) TLV. |
||
56 | |||
57 | +---------+---------+-------------------+ |
||
58 | |Component|Component| +---------------+ | |
||
59 | | Type | Length | | SignatureInfo | | |
||
60 | | | | | TLV | | |
||
61 | | | | +---------------+ | |
||
62 | +---------+---------+-------------------+ |
||
63 | |||
64 | | | |
||
65 | |<---------The n-1 th Component-------->| |
||
66 | |||
67 | ### SignatureValue component (n *th*) |
||
68 | |||
69 | The value of the n *th* component is actually a [SignatureValue](http://named-data.net/doc/ndn-tlv/signature.html) TLV. |
||
70 | |||
71 | +---------+---------+--------------------+ |
||
72 | |Component|Component| +----------------+ | |
||
73 | | Type | Length | | SignatureValue | | |
||
74 | | | | | TLV | | |
||
75 | | | | +----------------+ | |
||
76 | +---------+---------+--------------------+ |
||
77 | |||
78 | | | |
||
79 | |<----------The n th Component---------->| |
||
80 | |||
81 | ## Command Interest processing |
||
82 | |||
83 | 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. |
||
84 | If the received Interest is supposed to be signed, it will be treated as invalid in the following four cases: |
||
85 | |||
86 | - one of the three components above (SignatureValue, SignatureInfo, and Timestamp) is missing or cannot be parsed correctly; |
||
87 | - the key is not trusted for signing the control command; |
||
88 | - 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; |
||
89 | - the producer has already received a valid signed Interest whose timestamp is **equal or later** than the timestamp of the received one. |
||
90 | |||
91 | Note that in order to detect the fourth case, the producer needs to maintain a *latest timestamp* state for each trusted public key (or global *latest timestamp* for all trusted public keys). |
||
92 | For each trusted public key, the state is initialized as the timestamp of the first valid Interest signed by the key. |
||
93 | Since then, the state will be updated every time when the producer receives a valid command Interest. |
||
94 | |||
95 | Note that for the first Interest, the state is not available. |
||
96 | 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]. |
||
97 | The first interest is invalid if its timestamp is outside of the interval. |