Yingdi Yu | 4e99f53 | 2014-08-25 19:40:57 -0700 | [diff] [blame] | 1 | Signed Interest |
| 2 | =============== |
| 3 | |
| 4 | **Signed Interest** is a mechanism to issue an authenticated interest. |
| 5 | |
| 6 | The signature of a signed Interest packet is embedded into the last component of the Interest |
| 7 | name. The signature covers a continuous block starting from the first name component TLV to the |
| 8 | penultimate 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 | |
| 26 | More specifically, the SignedInterest is defined to have four additional components: |
| 27 | |
| 28 | - ``<timestamp>`` |
| 29 | - ``<nonce>`` |
| 30 | - ``<SignatureInfo>`` |
| 31 | - ``<SignatureValue>`` |
| 32 | |
| 33 | For 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 | |
| 44 | Signed Interest specific Name components |
| 45 | ---------------------------------------- |
| 46 | |
| 47 | Timestamp component (n-3 *th*) |
| 48 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 49 | |
| 50 | The value of the n-3 *th* component is the interest's timestamp (in terms of millisecond offset |
| 51 | from UTC 1970-01-01 00:00:00) encoded as |
| 52 | `nonNegativeInteger <http://named-data.net/doc/ndn-tlv/tlv.html#non-negative-integer-encoding>`__. |
| 53 | The timestamp may be used to protect against replay attack. |
| 54 | |
| 55 | Nonce component (n-2 *th*) |
| 56 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 57 | |
| 58 | The 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>`__) |
| 60 | that adds additional assurances that the interest will be unique. |
| 61 | |
| 62 | SignatureInfo component (n-1 *th*) |
| 63 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 64 | |
| 65 | The 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 | |
| 80 | SignatureValue component (n *th*) |
| 81 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 82 | |
| 83 | The 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 | |
| 98 | Signed Interest processing |
| 99 | -------------------------- |
| 100 | |
| 101 | On receiving an Interest, the producer, according to the Interest name prefix, should be able |
| 102 | to tell whether the Interest is required to be signed. If the received Interest is supposed to |
| 103 | be 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 | |
| 112 | Recipients of a signed interest may further check the timestamp and the uniqueness of the |
| 113 | signed interest (e.g., when the signed interest carries a command). In this case, a signed |
| 114 | interest 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 | |
| 119 | Note that in order to detect this situation, the recipient needs to maintain a *latest |
| 120 | timestamp* state for each trusted public key (**Since public key cryptography is used, sharing |
| 121 | private keys is not recommended. If private key sharing is inevitable, it is the key owner's |
| 122 | responsibility to keep clock synchronized**). For each trusted public key, the state is |
| 123 | initialized as the timestamp of the first valid Interest signed by the key. Since then, the |
| 124 | state will be updated every time when the recipient receives a valid signed Interest. |
| 125 | |
| 126 | Note that for the first Interest, the state is not available. To handle this special situation, |
| 127 | the recipient should check the Interest's timestamp against a grace interval (e.g., 120 |
| 128 | seconds) [current\_timestamp - interval/2, current\_timestamp + interval/2]. The first interest |
| 129 | is invalid if its timestamp is outside of the interval. |