A General Mechanism for RTP Header Extensions [
RFC 8285] defines two values for the "defined by profile" field for carrying one-byte and two-byte header extensions. In order to allow a receiver to determine if an incoming RTP packet is using the encryption scheme in this specification, two new values are defined:
-
0xC0DE for the encrypted version of the one-byte header extensions (instead of 0xBEDE).
-
0xC2DE for the encrypted versions of the two-byte header extensions (instead of 0x100).
In the case of using two-byte header extensions, the extension identifier with value 256
MUST NOT be negotiated, as the value of this identifier is meant to be contained in the "appbits" of the "defined by profile" field, which are not available when using the values above.
Note that as per [
RFC 8285], it is not possible to mix one-byte and two-byte headers on the same RTP packet. Mixing one-byte and two-byte headers on the same RTP stream requires negotiation of the "extmap-allow-mixed" SDP attribute as defined in
Section 6 of
RFC 8285.
Peers
MAY negotiate both Cryptex and the Encryption of Header Extensions mechanism defined in [
RFC 6904] via SDP offer/answer as described in
Section 4, and if both mechanisms are supported, either one can be used for any given packet. However, if a packet is encrypted with Cryptex, it
MUST NOT also use header extension encryption [
RFC 6904], and vice versa.
If one of the peers has advertised the ability to receive both Cryptex and header extensions encrypted as per [
RFC 6904] in the SDP exchange, it is
RECOMMENDED that the other peer use Cryptex rather than the mechanism in [
RFC 6904] when sending RTP packets so that all the header extensions and CSRCS are encrypted. However, if there is a compelling reason to use the mechanism in [
RFC 6904] (e.g., a need for some header extensions to be sent in the clear so that so they are processable by RTP middleboxes), the other peer
SHOULD use the mechanism in [
RFC 6904] instead.
When the mechanism defined by this specification has been negotiated, sending an RTP packet that has any CSRCs or contains any header extensions [
RFC 8285] follows the steps below. This mechanism
MUST NOT be used with header extensions other than the variety described in [
RFC 8285].
If the RTP packet contains one-byte headers, the 16-bit RTP header extension tag
MUST be set to 0xC0DE to indicate that the encryption has been applied and the one-byte framing is being used. If the RTP packet contains two-byte headers, the header extension tag
MUST be set to 0xC2DE to indicate encryption has been applied and the two-byte framing is being used.
If the packet contains CSRCs but no header extensions, an empty extension block consisting of the 0xC0DE tag and a 16-bit length field set to zero (explicitly permitted by [
RFC 3550])
MUST be appended, and the X bit
MUST be set to 1 to indicate an extension block is present. This is necessary to provide the receiver an indication that the CSRCs in the packet are encrypted.
The RTP packet
MUST then be encrypted as described in
Section 6.2 ("Encryption Procedure").
When receiving an RTP packet that contains header extensions, the "defined by profile" field
MUST be checked to ensure the payload is formatted according to this specification. If the field does not match one of the values defined above, the implementation
MUST instead handle it according to the specification that defines that value.
Alternatively, if the implementation considers the use of this specification mandatory and the "defined by profile" field does not match one of the values defined above, it
MUST stop the processing of the RTP packet and report an error for the RTP stream.
If the RTP packet passes this check, it is then decrypted as described in
Section 6.3 ("Decryption Procedure") and passed to the next layer to process the packet and its extensions. In the event that a zero-length extension block was added as indicated above, it can be left as is and will be processed normally.