← Chrome 160 reference · All APIs
v160 · webrtc · enabled by default
RTP Header Extension Encryption
Implements RFC 9335 (CRYPTEX) in WebRTC so SRTP encryption covers RTP header extensions and contributing source (CSRC) identifiers, controlled via the RTCConfiguration.rtpHeaderEncryptionPolicy option ("disable", "negotiate", or "require") and signaled with the a=cryptex SDP attribute.
at a glance
| Shipped in | Chrome 160 (desktop, Android, Android WebView), enabled by default — filed under “Enabled by default” in the milestone=160 listing and ChromeStatus API record |
|---|---|
| Runtime flag | Blink runtime feature RtcRtpHeaderEncryptionPolicy in runtime_enabled_features.json5 (Finch name RtcRtpHeaderEncryptionPolicy; no dedicated chrome://flags entry) |
| Specification | W3C WebRTC Extensions — RTP Header Encryption (PR #256); RFC 9335 (CRYPTEX) |
| Explainer | WebRTC RTP Header Extension Encryption explainer |
| Intent | blink-dev Intent to Ship |
| Tracking bug | issues.chromium.org/455813732 |
| Web platform tests | webrtc-extensions/RTCConfiguration-rtpHeaderEncryptionPolicy.html (WPT source) |
| ChromeStatus | 5177732519559168 — RTP Header Extension Encryption |
why it exists
Standard SRTP (RFC 3711) encrypts RTP media payloads while leaving the RTP header, contributing source (CSRC) identifiers, and RTP header extensions in the clear. That leaks packet-level metadata such as client-to-mixer audio levels (revealing voice activity), absolute send times, transport feedback sequence numbers, and conference participant identifiers to passive network observers. The older RFC 6904 mechanism required cumbersome per-extension negotiation and did not encrypt CSRCs. RFC 9335 (CRYPTEX) reuses existing SRTP encryption keys (implemented in libSRTP) to encrypt all RTP header extensions and CSRCs at once, negotiated with a single a=cryptex SDP attribute.
Syntax
Normative WebIDL from W3C WebRTC Extensions and Chromium’s rtc_configuration.idl:
enum RTCRtpHeaderEncryptionPolicy {
"disable",
"negotiate",
"require"
};
partial dictionary RTCConfiguration {
RTCRtpHeaderEncryptionPolicy rtpHeaderEncryptionPolicy = "negotiate";
};
This reference covers all three parts of the Chrome 160 contract: the RTCRtpHeaderEncryptionPolicy enum, the RTCConfiguration.rtpHeaderEncryptionPolicy dictionary member, and SDP a=cryptex negotiation and packet enforcement.
RTCRtpHeaderEncryptionPolicy enum
Inputs & allowed values. RTCRtpHeaderEncryptionPolicy accepts exactly three string values when passed in new RTCPeerConnection({ rtpHeaderEncryptionPolicy }). Any unrecognized string fails WebIDL enum conversion with a TypeError before the connection is created.
| Value | SDP a=cryptex in offers / answers | Remote omits a=cryptex | Wire behavior |
|---|---|---|---|
"disable" | Never included; ignored if present in remote SDP | Accepted | RTP header extensions and CSRCs are sent in the clear (standard RFC 3711 SRTP) |
"negotiate" (spec & IDL default) | Included in offers and in answers to offers containing a=cryptex | Accepted; falls back to clear header extensions | Encrypts header extensions and CSRCs via RFC 9335 once both endpoints signal a=cryptex |
"require" | Included in offers and answers for all RTP media sections | setRemoteDescription() rejects with InvalidAccessError | CRYPTEX is mandatory (RFC 9335 §5.2); received RTP packets not encrypted with CRYPTEX are dropped |
Outputs & rollout note. Both the W3C specification, Blink’s rtc_configuration.idl, and WPT define "negotiate" as the default value. The ChromeStatus activation note mentions considering "disable" during staged rollout to reduce risk before switching to "negotiate"; check pc.getConfiguration().rtpHeaderEncryptionPolicy at runtime rather than assuming the default without probing.
RTCConfiguration.rtpHeaderEncryptionPolicy member
Inputs. Passed optionally in the configuration dictionary to new RTCPeerConnection(configuration). Applies globally to the entire RTCPeerConnection (there is no per-transceiver override). If omitted, the dictionary default "negotiate" applies.
Outputs. Reflected on pc.getConfiguration().rtpHeaderEncryptionPolicy as the active RTCRtpHeaderEncryptionPolicy string ("disable", "negotiate", or "require"). In browsers that do not implement this extension, pc.getConfiguration().rtpHeaderEncryptionPolicy is undefined even if passed to the constructor.
Immutability & lifecycle. Like bundlePolicy and rtcpMuxPolicy, rtpHeaderEncryptionPolicy is fixed at construction time. Calling pc.setConfiguration() with a different rtpHeaderEncryptionPolicy fails per the W3C set-the-configuration algorithm (WebRTC Extensions) with InvalidModificationError.
SDP a=cryptex negotiation and packet enforcement
Inputs & SDP placement. The a=cryptex SDP attribute is assigned to the TRANSPORT category (RFC 8859 / RFC 9335 §4). It may appear at session level or on media sections. Under BUNDLE, a=cryptex must apply either to every RTP-based m= section (audio, video) in the bundle group or to none of them. It is never placed on data-channel sections (m=application ... UDP/DTLS/SCTP webrtc-datachannel), and an offer containing only a data channel is accepted under rtpHeaderEncryptionPolicy: "require" without a=cryptex.
Outputs & state transitions.
- Offer generation (
createOffer()/setLocalDescription()): emitsa=cryptexfor all RTPm=sections under"negotiate"and"require"; omits it under"disable". - Answer generation: includes
a=cryptexonly if the remote offer includeda=cryptexand the answerer’s policy is"negotiate"or"require"; omits it under"disable". - Remote description validation (
setRemoteDescription()): under"require", rejects withDOMException("InvalidAccessError")if a remote offer or answer with RTP media lacksa=cryptex(including when the remote peer uses"disable"or stripsa=cryptex). Under"negotiate", an answer withouta=cryptexsucceeds and media flows with clear header extensions. Under"disable", an unexpecteda=cryptexin a remote answer is ignored and media flows without CRYPTEX. - Wire enforcement under
"require": per RFC 9335 §5.2, even if a remote peer sends unencrypted RTP header extensions after signalinga=cryptex(for example via SDP tampering), the receiving endpoint discards those packets without processing them (inbound-rtppacketsReceivedremains0).
Errors and recovery
TypeError(constructor /setConfiguration()): thrown synchronously ifrtpHeaderEncryptionPolicyis set to a string other than"disable","negotiate", or"require".InvalidModificationError(setConfiguration()): thrown synchronously if you attempt to changertpHeaderEncryptionPolicyafter constructing theRTCPeerConnection. To switch policies, create a newRTCPeerConnectionand renegotiate.InvalidAccessError(setRemoteDescription()): returned as a rejectedPromisewhenrtpHeaderEncryptionPolicyis"require"and a remote offer or answer containing RTP media sections does not negotiatea=cryptex. Recovery: either surface a peer-incompatibility error to the user or fall back by creating a newRTCPeerConnectionwith"negotiate"if your threat model allows unencrypted header extensions.- Silent packet drop under
"require": if a peer advertisesa=cryptexin SDP but transmits non-CRYPTEX RTP packets, no exception is thrown; monitorgetStats()(inbound-rtp.packetsReceived) to detect stalled media.
Context and exposure
RTCPeerConnection and RTCConfiguration.rtpHeaderEncryptionPolicy are exposed in Window contexts only (not Web Workers). Constructing RTCPeerConnection and applying rtpHeaderEncryptionPolicy does not require camera or microphone permissions, though adding captured media tracks via navigator.mediaDevices.getUserMedia() requires a secure context and user permission. No extra permissions policy or user activation is required for CRYPTEX negotiation.
Examples
RTCConfiguration.rtpHeaderEncryptionPolicy. Source: Chrome Platform Showcase (policy-probe); more demos at v160/rtp-header-extension-encryption.Feature detection and requiring CRYPTEX
function supportsRtpHeaderEncryptionPolicy() {
const probe = new RTCPeerConnection();
try {
return typeof probe.getConfiguration().rtpHeaderEncryptionPolicy === "string";
} finally {
probe.close();
}
}
async function connectWithCryptexRequired(remoteOfferSdp) {
if (!supportsRtpHeaderEncryptionPolicy()) {
throw new Error("Browser does not support RTCConfiguration.rtpHeaderEncryptionPolicy");
}
// Enforce RFC 9335 CRYPTEX on all RTP m= sections
const pc = new RTCPeerConnection({
rtpHeaderEncryptionPolicy: "require",
});
try {
await pc.setRemoteDescription({ type: "offer", sdp: remoteOfferSdp });
} catch (err) {
if (err.name === "InvalidAccessError") {
// Remote peer did not include a=cryptex for RTP media sections
pc.close();
throw new Error("Remote endpoint does not support RFC 9335 CRYPTEX", { cause: err });
}
throw err;
}
await pc.setLocalDescription(); // Answer includes a=cryptex
return pc;
}
Source: WPT RTCConfiguration-rtpHeaderEncryptionPolicy.html; W3C WebRTC Extensions.
Checking negotiated a=cryptex in local and remote SDP
function hasCryptexOnAllRtpSections(sdp) {
const sections = sdp.split(/\r?\n(?=m=)/);
const sessionHasCryptex = /^a=cryptex\b/m.test(sections[0] ?? "");
const rtpSections = sections.slice(1).filter((s) => !s.startsWith("m=application "));
return (
rtpSections.length > 0 &&
rtpSections.every((s) => sessionHasCryptex || /^a=cryptex\b/m.test(s))
);
}
// Default "negotiate" policy offers a=cryptex and falls back if remote omits it
const pc = new RTCPeerConnection({ rtpHeaderEncryptionPolicy: "negotiate" });
pc.addTransceiver("audio");
const offer = await pc.createOffer();
console.log("Offer advertises a=cryptex:", hasCryptexOnAllRtpSections(offer.sdp));
Source: WPT RTCConfiguration-rtpHeaderEncryptionPolicy.html; RFC 9335 §4.
Browser compatibility
| Browser / engine | Support | Evidence / notes |
|---|---|---|
| Chrome (desktop, Android, WebView) | 160 | Enabled by default in Chrome 160 per ChromeStatus 5177732519559168 (Blink runtime feature RtcRtpHeaderEncryptionPolicy) |
| Edge | Unknown (Chromium) | Follows Chromium; no dedicated BCD entry yet |
| Firefox | No release | mozilla/standards-positions#1413 (No formal signal; Mozilla WG rep approved w3c/webrtc-extensions#256) |
| Safari | No release | WebKit/standards-positions#671 (No formal signal; Apple WG rep approved w3c/webrtc-extensions#256) |
| Non-browser (Pion WebRTC) | In progress | Interoperability implementation tracked in pion/webrtc#3357 |
Security and privacy
Encrypting RTP header extensions and CSRCs closes a long-standing metadata leak in SRTP streams: without CRYPTEX, an on-path observer can infer who is speaking in a conference call from RFC 6464 audio-level header extensions and CSRC lists, or correlate traffic timing from absolute-send-time headers, even though the media payload itself is encrypted. Reusing existing SRTP keys avoids additional key-exchange round trips.
Downgrade protection. Under the default "negotiate" policy, an active signaling attacker who can strip a=cryptex from SDP can cause peers to fall back to unencrypted header extensions. Applications that require header-extension confidentiality against signaling downgrades MUST set rtpHeaderEncryptionPolicy: "require" on both peers (and protect SDP signaling integrity); under "require", Chromium rejects remote descriptions missing a=cryptex with InvalidAccessError and drops received RTP packets that are not CRYPTEX-encrypted. Offering a "disable" option does not introduce a downgrade vulnerability because CRYPTEX negotiation is opt-in unless "require" is specified.
Specifications
see also
- Chrome Platform Showcase — RTP Header Extension Encryption demos (SDP inspector, negotiation matrix, downgrade guard)
- Explainer — WebRTC RTP Header Extension Encryption
- w3c/webrtc-extensions#234 — At-risk tracking issue
- MDN —
RTCPeerConnection()constructor - ChromeStatus — RTP Header Extension Encryption (5177732519559168)