Command Interests » History » Version 4
Alex Afanasyev, 02/15/2014 09:02 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 | 4 | Alex Afanasyev | |
| 33 | For example, for ``/signed/interest/name`` name, CommandInterest will be defined as: |
||
| 34 | |||
| 35 | 3 | Alex Afanasyev | /signed/interest/name/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue> |
| 36 | \ / |
||
| 37 | ------------------------- ------------------------------ |
||
| 38 | 1 | Yingdi Yu | \/ |
| 39 | Additional components of Command Interest |
||
| 40 | |||
| 41 | |||
| 42 | ## Signed Interest specific Name components |
||
| 43 | |||
| 44 | ### Timestamp component (n-3 *th*) |
||
| 45 | |||
| 46 | 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). |
||
| 47 | The timestamp is used to protect against replay attack. |
||
| 48 | |||
| 49 | ### Random value (n-2 *th*) |
||
| 50 | |||
| 51 | 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. |
| 52 | The random value is also encoded as [nonNegativeInteger](http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding). |
||
| 53 | 1 | Yingdi Yu | |
| 54 | ### SignatureInfo component (n-1 *th*) |
||
| 55 | |||
| 56 | The value of the n-1 *th* component is actually a [SignatureInfo](http://named-data.net/doc/ndn-tlv/signature.html) TLV. |
||
| 57 | |||
| 58 | +---------+---------+-------------------+ |
||
| 59 | |Component|Component| +---------------+ | |
||
| 60 | | Type | Length | | SignatureInfo | | |
||
| 61 | | | | | TLV | | |
||
| 62 | | | | +---------------+ | |
||
| 63 | +---------+---------+-------------------+ |
||
| 64 | |||
| 65 | | | |
||
| 66 | |<---------The n-1 th Component-------->| |
||
| 67 | |||
| 68 | ### SignatureValue component (n *th*) |
||
| 69 | |||
| 70 | The value of the n *th* component is actually a [SignatureValue](http://named-data.net/doc/ndn-tlv/signature.html) TLV. |
||
| 71 | |||
| 72 | +---------+---------+--------------------+ |
||
| 73 | |Component|Component| +----------------+ | |
||
| 74 | | Type | Length | | SignatureValue | | |
||
| 75 | | | | | TLV | | |
||
| 76 | | | | +----------------+ | |
||
| 77 | +---------+---------+--------------------+ |
||
| 78 | |||
| 79 | | | |
||
| 80 | |<----------The n th Component---------->| |
||
| 81 | |||
| 82 | ## Command Interest processing |
||
| 83 | |||
| 84 | 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. |
||
| 85 | If the received Interest is supposed to be signed, it will be treated as invalid in the following four cases: |
||
| 86 | |||
| 87 | - one of the three components above (SignatureValue, SignatureInfo, and Timestamp) is missing or cannot be parsed correctly; |
||
| 88 | - the key is not trusted for signing the control command; |
||
| 89 | - 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; |
||
| 90 | - the producer has already received a valid signed Interest whose timestamp is **equal or later** than the timestamp of the received one. |
||
| 91 | |||
| 92 | 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). |
||
| 93 | For each trusted public key, the state is initialized as the timestamp of the first valid Interest signed by the key. |
||
| 94 | Since then, the state will be updated every time when the producer receives a valid command Interest. |
||
| 95 | |||
| 96 | Note that for the first Interest, the state is not available. |
||
| 97 | 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]. |
||
| 98 | The first interest is invalid if its timestamp is outside of the interval. |