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