v160 · webrtc · peer connection
RTP Header Extension Encryption
WebRTC media has always been encrypted with SRTP — but only the payload. Every packet's RTP header extensions (audio level, send time, stream ids, video orientation…) and its list of contributing sources (CSRCs) crossed the network in the clear. RFC 9335, “cryptex”, reuses the SRTP keys to encrypt them too, negotiated by a single a=cryptex SDP line. Chrome 160 implements it with one new RTCConfiguration member: rtpHeaderEncryptionPolicy, "disable" | "negotiate" (default) | "require".
concepts
-
Policy probe
The whole API in one page: construct peer connections with every enum value, read them back through
getConfiguration(), discover which vocabulary this build accepts, and try to change the policy after construction — which the spec forbids. -
SDP cryptex inspector
Build a real offer with your choice of policy, bundle policy and audio/video/data-channel sections. See where
a=cryptexlands, that it covers every RTP section and never the data channel, and exactly which header extensions it takes out of the clear. -
Negotiation matrix
Every offerer × answerer policy pairing, each a real offer/answer between two in-page peers — with switches that strip
a=cryptexin transit the way an old signalling server or SBC might. Encrypted, clear, rejected or one-sided, per cell, with logs. -
Require: downgrade guard
Live synthetic audio and video between two peers. Watch
getStats()show"require"rejecting a stripped answer withInvalidAccessError, a"require"receiver dropping every clear-header packet, and"negotiate"silently falling back. -
Voice-activity leak
Why it matters: two concurrent calls, one with cryptex and one without. Both receivers report identical
audioLevelviagetSynchronizationSources()— the RFC 6464 header extension that, without cryptex, tells any on-path observer exactly when you speak.
why it shipped
RFC 6904, the old per-extension header encryption, was cumbersome and saw little use. Cryptex (January 2023) covers the whole extension block and the CSRCs with the existing SRTP context and one SDP attribute, and libSRTP — which browsers depend on — recently gained support. The W3C API had been marked at risk for lack of implementations; implementation feedback then shrank it (PR #256: added "disable", dropped the per-transceiver read-only signal). The ChromeStatus activation-risk note says the owners weighed a "disable" default for the initial roll-out (“we should switch the default from disable to negotiate but for the initial roll-out disable seems less risky”); the IDL default — and what a flagged Chrome 153 reports — is "negotiate", so check getConfiguration() rather than assuming. The policy is never a downgrade attack vector because cryptex is optional unless you choose "require".
the API
// Default: offer cryptex, fall back to clear headers if the peer can't.
const pc = new RTCPeerConnection(); // rtpHeaderEncryptionPolicy: "negotiate"
// Refuse calls that would expose header extensions / CSRCs:
const strict = new RTCPeerConnection({ rtpHeaderEncryptionPolicy: "require" });
await strict.setRemoteDescription(answerWithoutCryptex);
// → rejects: InvalidAccessError
// Opt out (e.g. a middlebox that must read header extensions):
new RTCPeerConnection({ rtpHeaderEncryptionPolicy: "disable" });
// Feature detection — the member only appears when implemented:
"rtpHeaderEncryptionPolicy" in new RTCPeerConnection().getConfiguration();
// SDP: one session-level line under BUNDLE
// a=cryptex
flag & availability
Blink runtime feature RtcRtpHeaderEncryptionPolicy (status experimental in runtime_enabled_features.json5; Finch name the same). No dedicated chrome://flags entry. To try it before it ships: chrome://flags/#enable-experimental-web-platform-features, or launch with --enable-blink-features=RtcRtpHeaderEncryptionPolicy or --enable-features=RtcRtpHeaderEncryptionPolicy. Builds from before webrtc-extensions PR #256 (for example Chrome 153 with the flag) know only "negotiate" and "require"; every page here detects the vocabulary rather than assuming it.
references
- ChromeStatus entry
- WebRTC Extensions § RTP Header Encryption
- Explainer (Philipp Hancke)
- RFC 9335 — Completely Encrypting RTP Header Extensions and Contributing Sources
- webrtc-extensions PR #256 — smaller API, adds "disable"
- issues.chromium.org/455813732 — implementation tracking
- WPT: RTCConfiguration-rtpHeaderEncryptionPolicy.html
- Pion cryptex implementation (interop)