⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfc3711.txt

📁 mediastreamer2是开源的网络传输媒体流的库
💻 TXT
📖 第 1 页 / 共 5 页
字号:
      cryptographic context, according to Section 8.1.   4. Determine the session keys and session salt (if they are used by      the transform) as described in Section 4.3, using master key,      master salt, key_derivation_rate, and session key-lengths in the      cryptographic context with the index, determined in Steps 2 and 3.   5. Encrypt the RTP payload to produce the Encrypted Portion of the      packet (see Section 4.1, for the defined ciphers).  This step uses      the encryption algorithm indicated in the cryptographic context,      the session encryption key and the session salt (if used) found in      Step 4 together with the index found in Step 2.   6. If the MKI indicator is set to one, append the MKI to the packet.   7. For message authentication, compute the authentication tag for the      Authenticated Portion of the packet, as described in Section 4.2.      This step uses the current rollover counter, the authenticationBaugher, et al.             Standards Track                    [Page 11]RFC 3711                          SRTP                        March 2004      algorithm indicated in the cryptographic context, and the session      authentication key found in Step 4.  Append the authentication tag      to the packet.   8. If necessary, update the ROC as in Section 3.3.1, using the packet      index determined in Step 2.   To authenticate and decrypt an SRTP packet, the receiver SHALL do the   following:   1. Determine which cryptographic context to use as described in      Section 3.2.3.   2. Run the algorithm in Section 3.3.1 to get the index of the SRTP      packet.  The algorithm uses the rollover counter and highest      sequence number in the cryptographic context with the sequence      number in the SRTP packet, as described in Section 3.3.1.   3. Determine the master key and master salt.  If the MKI indicator in      the context is set to one, use the MKI in the SRTP packet,      otherwise use the index from the previous step, according to      Section 8.1.   4. Determine the session keys, and session salt (if used by the      transform) as described in Section 4.3, using master key, master      salt, key_derivation_rate and session key-lengths in the      cryptographic context with the index, determined in Steps 2 and 3.   5. For message authentication and replay protection, first check if      the packet has been replayed (Section 3.3.2), using the Replay      List and the index as determined in Step 2.  If the packet is      judged to be replayed, then the packet MUST be discarded, and the      event SHOULD be logged.      Next, perform verification of the authentication tag, using the      rollover counter from Step 2, the authentication algorithm      indicated in the cryptographic context, and the session      authentication key from Step 4.  If the result is "AUTHENTICATION      FAILURE" (see Section 4.2), the packet MUST be discarded from      further processing and the event SHOULD be logged.   6. Decrypt the Encrypted Portion of the packet (see Section 4.1, for      the defined ciphers), using the decryption algorithm indicated in      the cryptographic context, the session encryption key and salt (if      used) found in Step 4 with the index from Step 2.Baugher, et al.             Standards Track                    [Page 12]RFC 3711                          SRTP                        March 2004   7. Update the rollover counter and highest sequence number, s_l, in      the cryptographic context as in Section 3.3.1, using the packet      index estimated in Step 2.  If replay protection is provided, also      update the Replay List as described in Section 3.3.2.   8. When present, remove the MKI and authentication tag fields from      the packet.3.3.1.  Packet Index Determination, and ROC, s_l Update   SRTP implementations use an "implicit" packet index for sequencing,   i.e., not all of the index is explicitly carried in the SRTP packet.   For the pre-defined transforms, the index i is used in replay   protection (Section 3.3.2), encryption (Section 4.1), message   authentication (Section 4.2), and for the key derivation (Section   4.3).   When the session starts, the sender side MUST set the rollover   counter, ROC, to zero.  Each time the RTP sequence number, SEQ, wraps   modulo 2^16, the sender side MUST increment ROC by one, modulo 2^32   (see security aspects below).  The sender's packet index is then   defined as      i = 2^16 * ROC + SEQ.   Receiver-side implementations use the RTP sequence number to   determine the correct index of a packet, which is the location of the   packet in the sequence of all SRTP packets.  A robust approach for   the proper use of a rollover counter requires its handling and use to   be well defined.  In particular, out-of-order RTP packets with   sequence numbers close to 2^16 or zero must be properly handled.   The index estimate is based on the receiver's locally maintained ROC   and s_l values.  At the setup of the session, the ROC MUST be set to   zero.  Receivers joining an on-going session MUST be given the   current ROC value using out-of-band signaling such as key-management   signaling.  Furthermore, the receiver SHALL initialize s_l to the RTP   sequence number (SEQ) of the first observed SRTP packet (unless the   initial value is provided by out of band signaling such as key   management).   On consecutive SRTP packets, the receiver SHOULD estimate the index   as         i = 2^16 * v + SEQ,   where v is chosen from the set { ROC-1, ROC, ROC+1 } (modulo 2^32)   such that i is closest (in modulo 2^48 sense) to the value 2^16 * ROC   + s_l (see Appendix A for pseudocode).Baugher, et al.             Standards Track                    [Page 13]RFC 3711                          SRTP                        March 2004   After the packet has been processed and authenticated (when enabled   for SRTP packets for the session), the receiver MUST use v to   conditionally update its s_l and ROC variables as follows.  If   v=(ROC-1) mod 2^32, then there is no update to s_l or ROC.  If v=ROC,   then s_l is set to SEQ if and only if SEQ is larger than the current   s_l; there is no change to ROC.  If v=(ROC+1) mod 2^32, then s_l is   set to SEQ and ROC is set to v.   After a re-keying occurs (changing to a new master key), the rollover   counter always maintains its sequence of values, i.e., it MUST NOT be   reset to zero.   As the rollover counter is 32 bits long and the sequence number is 16   bits long, the maximum number of packets belonging to a given SRTP   stream that can be secured with the same key is 2^48 using the pre-   defined transforms.  After that number of SRTP packets have been sent   with a given (master or session) key, the sender MUST NOT send any   more packets with that key.  (There exists a similar limit for SRTCP,   which in practice may be more restrictive, see Section 9.2.)  This   limitation enforces a security benefit by providing an upper bound on   the amount of traffic that can pass before cryptographic keys are   changed.  Re-keying (see Section 8.1) MUST be triggered, before this   amount of traffic, and MAY be triggered earlier, e.g., for increased   security and access control to media.  Recurring key derivation by   means of a non-zero key_derivation_rate (see Section 4.3), also gives   stronger security but does not change the above absolute maximum   value.   On the receiver side, there is a caveat to updating s_l and ROC: if   message authentication is not present, neither the initialization of   s_l, nor the ROC update can be made completely robust.  The   receiver's "implicit index" approach works for the pre-defined   transforms as long as the reorder and loss of the packets are not too   great and bit-errors do not occur in unfortunate ways.  In   particular, 2^15 packets would need to be lost, or a packet would   need to be 2^15 packets out of sequence before synchronization is   lost.  Such drastic loss or reorder is likely to disrupt the RTP   application itself.   The algorithm for the index estimate and ROC update is a matter of   implementation, and should take into consideration the environment   (e.g., packet loss rate) and the cases when synchronization is likely   to be lost, e.g., when the initial sequence number (randomly chosen   by RTP) is not known in advance (not sent in the key management   protocol) but may be near to wrap modulo 2^16.Baugher, et al.             Standards Track                    [Page 14]RFC 3711                          SRTP                        March 2004   A more elaborate and more robust scheme than the one given above is   the handling of RTP's own "rollover counter", see Appendix A.1 of   [RFC3550].3.3.2.  Replay Protection   Secure replay protection is only possible when integrity protection   is present.  It is RECOMMENDED to use replay protection, both for RTP   and RTCP, as integrity protection alone cannot assure security   against replay attacks.   A packet is "replayed" when it is stored by an adversary, and then   re-injected into the network.  When message authentication is   provided, SRTP protects against such attacks through a Replay List.   Each SRTP receiver maintains a Replay List, which conceptually   contains the indices of all of the packets which have been received   and authenticated.  In practice, the list can use a "sliding window"   approach, so that a fixed amount of storage suffices for replay   protection.  Packet indices which lag behind the packet index in the   context by more than SRTP-WINDOW-SIZE can be assumed to have been   received, where SRTP-WINDOW-SIZE is a receiver-side, implementation-   dependent parameter and MUST be at least 64, but which MAY be set to   a higher value.   The receiver checks the index of an incoming packet against the   replay list and the window.  Only packets with index ahead of the   window, or, inside the window but not already received, SHALL be   accepted.   After the packet has been authenticated (if necessary the window is   first moved ahead), the replay list SHALL be updated with the new   index.   The Replay List can be efficiently implemented by using a bitmap to   represent which packets have been received, as described in the   Security Architecture for IP [RFC2401].3.4.  Secure RTCP   Secure RTCP follows the definition of Secure RTP.  SRTCP adds three   mandatory new fields (the SRTCP index, an "encrypt-flag", and the   authentication tag) and one optional field (the MKI) to the RTCP   packet definition.  The three mandatory fields MUST be appended to an   RTCP packet in order to form an equivalent SRTCP packet.  The added   fields follow any other profile-specific extensions.Baugher, et al.             Standards Track                    [Page 15]RFC 3711                          SRTP                        March 2004   According to Section 6.1 of [RFC3550], there is a REQUIRED packet   format for compound packets.  SRTCP MUST be given packets according   to that requirement in the sense that the first part MUST be a sender   report or a receiver report.  However, the RTCP encryption prefix (a   random 32-bit quantity) specified in that Section MUST NOT be used   since, as is stated there, it is only applicable to the encryption   method specified in [RFC3550] and is not needed by the cryptographic   mechanisms used in SRTP.      0                   1                   2                   3      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<+     |V=2|P|    RC   |   PT=SR or RR   |             length          | |     +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |     |                         SSRC of sender                        | |   +>+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ |   | ~                          sender info                          ~ |   | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |   | ~                         report block 1                        ~ |   | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |   | ~                         report block 2                        ~ |   | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |   | ~                              ...                              ~ |   | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |   | |V=2|P|    SC   |  PT=SDES=202  |             length            | |   | +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ |   | |                          SSRC/CSRC_1                          | |   | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |   | ~                           SDES items                          ~ |   | +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ |   | ~                              ...                              ~ |   +>+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ |   | |E|                         SRTCP index                         | |   | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+<+   | ~                     SRTCP MKI (OPTIONAL)                      ~ |   | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |   | :                     authentication tag                        : |   | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |   |                                                                   |   +-- Encrypted Portion                    Authenticated Portion -----+   Figure 2.  An example of the format of a Secure RTCP packet,   consisting of an underlying RTCP compound packet with a Sender Report   and SDES packet.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -