What is DRM Encryption?
DRM encryption converts encoded media into ciphertext that a player can only decrypt with the matching content key. A license system releases that key and its usage rules to clients it authorizes.
How DRM Encryption works
Encryption is applied by the packager, after encoding. With Common Encryption (ISO/IEC 23001-7), which fragmented MP4 streams for DASH and HLS use, encrypted samples use a 128-bit AES key under one of the standard’s four schemes; the two that the W3C stream format for Encrypted Media Extensions permits are cenc (counter mode) and cbcs (cipher block chaining, with a pattern that encrypts only part of each video sample). A protected stream may also contain unencrypted samples, for example a clear lead at the start. The media does not expose the content key in the clear. It carries a key ID, by default in the track encryption box (tenc). What a DRM system’s client needs in order to request a license is its initialization data, and where that lives depends on the delivery format. For DASH, DASH-IF describes a protection system specific header (pssh) for each system, carried in the media, in the manifest as a cenc:pssh element, or in both; the manifest also states the key ID as cenc:default_KID. An HLS playlist signals keys in EXT-X-KEY tags, whose URI attribute specifies how to obtain the key; FairPlay content must use the key format com.apple.streamingkeydelivery in that tag. The player hands the initialization data to the device’s content decryption module, relays the module’s license request to the license service, and returns the license; decryption then happens inside the module. The samples are encrypted once and only the license is issued per client, so every viewer downloads the same encrypted segments and they can be shared and cached like unencrypted ones.
Key facts
- 1
cencorcbcs? The two schemes are not interchangeable, and a device must support the one the content was packaged with. FairPlay content must use the HLSSAMPLE-AESmethod, which RFC 8216 defines for fragmented MP4 as thecbcsscheme, and Apple’s authoring specification states thatSAMPLE-AES-CTRshall not be used on Apple devices. RFC 8216 defines no counter-mode method, yet Android’s Media3 documentation lists HLS in fragmented MP4 as a supported format for Widevinecencand, on Android TV, PlayReadycenc. The same documentation lists Widevinecencfrom Android 4.4 butcbcsonly from Android 7.1 (Widevine’s own platform table says Android 7.x and later), and PlayReady addedcbcsin client version 4.0, where it remains optional. A singlecbcscopy can therefore serve FairPlay, Widevine, and PlayReady clients that support the scheme, which a PlayReady 4.0 version number alone does not guarantee, and older Android or PlayReady clients need a second copy incenc. If you package both, Microsoft states that a service must not encrypt the same content in both modes with the same key ID and key. - 2Is the key ID secret, and what must it match? No, it is a label. The key ID travels unencrypted in the
tencbox, inpsshdata, and in DASH manifests, and tells the client and the license service which key is needed; only the key itself is secret and it is delivered inside a license. The identifiers have to agree at every level: DASH-IF requires the manifest’scenc:default_KIDto match the value in thetencbox, which it treats as the source of truth, and a license that supplies a key under a different ID leaves the samples undecryptable even though the stream loads. - 3Does one encrypted copy work with several DRM systems? Yes, for systems that support the scheme used: Common Encryption exists so that multiple key systems can decrypt the same media. Each system still needs its own signaling and a license service able to return the same key. Packagers generate that signaling per system; Shaka Packager, for example, can emit Widevine, PlayReady, and FairPlay signaling for one set of keys. Where the signaling lives matters for browsers: DASH-IF advises against
psshboxes in initialization segments, because each one a browser processes can start another license request unless the player detects and blocks the duplicates, and notes that carryingpsshdata in the manifest lets a DRM system be added without modifying the content. - 4When is key rotation worth its complexity? DASH-IF describes its main purpose as forcing periodic re-authorization for continuous live content, for example at program boundaries, and says explicitly that the aim is not to make the encryption stronger. In Common Encryption the changing key IDs are signaled per sample through
seigsample groups, optionally with license data inpsshboxes inside movie fragments; in HLS, eachEXT-X-KEYtag applies to the segments that follow it until the next tag with the sameKEYFORMATor the end of the playlist. Rotation needs player support (Android’s Media3 requires its multi-session mode for streams with rotating keys), key changes aligned to segment boundaries, and license requests spread over time so that all clients do not ask at the same instant. DASH-IF describes one way to spread them that makes the DRM system responsible: current and upcoming keys are announced inpsshdata, and each client picks a random time to request its license.
When DRM Encryption matters
Configure encryption while packaging streams intended for controlled playback and protect the keys separately. A mismatched key identifier, scheme, or license configuration makes correctly encoded media unplayable.
Sources
- W3C: ISO Common Encryption Protection Scheme for ISO Base Media File Format Stream Format
- W3C: “cenc” Initialization Data Format (pssh boxes)
- W3C Encrypted Media Extensions (encryption schemes, key IDs, content decryption modules)
- DASH-IF Interoperability Points v4.3, Chapter 7: Content Protection and Security (Sections 7.3, 7.5, and 7.7)
- RFC 8216 (HTTP Live Streaming), Section 4.3.2.4: EXT-X-KEY
- Apple: HLS Authoring Specification for Apple Devices (content protection requirements)
- Microsoft PlayReady: Content Encryption Modes (cenc and cbcs support by client version)
- Android Media3 ExoPlayer: Digital rights management (scheme support, key rotation)
- Google Widevine DRM overview (supported encryption schemes by platform)
- Shaka Packager documentation: DRM (protection schemes and protection systems)