Callaba

HLS Encryption: AES-128, SAMPLE-AES, Keys & DRM | Callaba

Aug 08, 2026

HLS encryption is not one checkbox at the packager. The player must discover which key applies, obtain it through an authorized path, decrypt the intended segment or media samples, and continue when the key changes. If the playlist, key service, cache policy, player, and entitlement service do not agree, playback fails even while every media object returns HTTP 200.

The protected playback path has four contracts

HLS encryption and key delivery boundaries A packager encrypts media and writes key signaling into playlists. A CDN delivers playlists and segments, while an authorized key or license service supplies keys to the player. PACKAGERencrypt mediawrite key signaling CDNplaylist + segmentscache by policy PLAYERauthorize · fetchdecrypt · decode KEY / LICENSEidentity · policy · key response encrypted mediaHTTPS viewer path
Media delivery and key delivery are related but separately authorized paths. A healthy CDN cannot compensate for a broken key or license response.

Where Callaba fits—and where HLS encryption remains separate

In Callaba, Web Player is the browser-delivery module: it publishes a supported media input as HLS or DASH and applies documented open, password, group, or pay-per-view access. That gives the team a real viewer URL and process statistics to test. Callaba does not currently document a Widevine, FairPlay, or PlayReady license service, a key-management system, or a general HLS AES-128/SAMPLE-AES packager. Select and prove those components separately.

NeedCallaba roleSeparate responsibility
Publish browser mediaCreate and test a Web Player from a supported inputConfirm whether the chosen encryption mode and packaging are supported end to end
Control viewer entryUse documented password, group, or pay-per-view accessKey authorization and DRM license policy are not implied by page access
Observe media processInspect Web Player input bitrate and cadence, then open the real viewer URLProbe playlist, encrypted segments, key/license request, and client decryption independently

Before connecting protected content to any player, use a known-good test asset from the selected encryption or DRM provider. Acceptance requires a successful authorized session and a deliberate denial test. “The manifest loads” proves neither key delivery nor policy enforcement.

AES-128 and SAMPLE-AES protect different media units

RFC 8216 defines EXT-X-KEY methods including AES-128 and SAMPLE-AES. AES-128 applies AES-CBC encryption to complete segments. SAMPLE-AES encrypts media samples according to their encoding and container; for fragmented MP4, the RFC points to the cbcs Common Encryption scheme.

DecisionAES-128SAMPLE-AES / DRM-oriented packaging
Encrypted unitComplete media segmentSelected bytes within audio or video samples
Playlist signalEXT-X-KEY with method, key URI, and optional IVEXT-X-KEY plus the required key format and format-specific signaling
Client workflowFetch an authorized key and decrypt segmentsUse the applicable key system, CDM, and license exchange where DRM is present
Policy strengthDepends heavily on key authorization and application controlsCan carry provider-specific license rules and device enforcement

Do not use “AES” and “DRM” as synonyms. Encryption makes media unreadable without a key. DRM coordinates packaging, license issuance, client decryption, policy, and supported device behavior. The DRM guide owns that broader definition.

The playlist tells the player when a key applies

An EXT-X-KEY tag applies to the following segments until another tag with the same key format changes the rule or the playlist ends. Unencrypted segments following encrypted ones need an explicit METHOD=NONE. Initialization sections also need compatible key signaling. These details make playlist history part of incident evidence.

For AES-128, the key file contains 16 octets when the key format is identity. The IV may be stated in the tag; otherwise the media sequence number is used as defined by RFC 8216. A mismatched IV produces media that was downloaded successfully but cannot be decoded correctly.

Key delivery is an authorization service

Serve playlists, segments, and keys over HTTPS, but do not rely on TLS alone. The key endpoint needs a defined viewer identity, entitlement decision, token lifetime, origin policy, rate limit, audit trail, and failure response. Avoid exposing a reusable key through a long-lived public URL, page source, analytics event, or client log.

CDN behavior deserves its own decision. Media segments benefit from caching; a personalized key or license response often needs a much narrower cache policy. Forward only the headers and cookies required by the authorization model. Test a cold request, a repeated request, a revoked entitlement, and requests from two different users.

Rotation limits the blast radius but creates coordination work

Key rotation changes the applicable key at a deliberate media boundary. The playlist update, encrypted media, key availability, CDN propagation, and player must agree on the transition. Rotating faster is not automatically safer if players frequently miss or cannot authorize the new key.

Write the rotation interval from content risk, entitlement policy, event duration, offline behavior, and operational capacity. Retain key identifiers and transition timestamps in protected logs; never retain plaintext keys in ordinary incident notes. A rollback plan should restore coherent playlist and key-service behavior, not publish the old key indefinitely.

Example: playback stops for some viewers at a rotation boundary

The playlist advances and new segments return 200, but affected sessions fail immediately after a new EXT-X-KEY appears. The first comparison is the old and new key request: URI, authorization context, status, cache headers, key identifier, and client error. If unaffected viewers obtain the new key, the root cause is likely in entitlement, token propagation, or cache variation—not the encoder. That evidence keeps the incident at the key-delivery boundary.

DRM begins where license and device policy matter

The W3C Encrypted Media Extensions give browser code a common way to discover and interact with a key system. EME is not itself a DRM product; the application still mediates license messages and authorization. Browser, OS, device, codec, encryption scheme, output protection, and persistent-license requirements shape the real compatibility matrix.

Apple's FairPlay Streaming documentation describes protected HLS delivery on Apple platforms. Widevine and PlayReady have their own client and license ecosystems. If premium-content rights require one or more of those systems, move to a multi-DRM design instead of presenting basic AES key retrieval as equivalent protection.

Commission protection with positive and negative tests

  1. Freeze a compatibility matrix. List browsers, devices, apps, codecs, packaging, encryption scheme, and key system.
  2. Use one known-good protected asset. Separate integration faults from live packager faults.
  3. Trace one authorized session. Correlate viewer authorization, playlist, segment, key or license request, and first decoded frame.
  4. Deny one unauthorized session. Confirm that the key or license fails closed without leaking media or sensitive detail.
  5. Cross a rotation boundary. Keep playback running before, during, and after the transition.
  6. Revoke and recover. Verify the documented behavior for expired tokens, removed entitlement, and service recovery.

Monitoring needs protected-path evidence

A synthetic monitor should fetch the playlist, follow an encrypted segment, authorize a test key or license, and decode on a representative client path. Keep the credential narrow and rotate it. Real-player telemetry should distinguish manifest, segment, EME/CDM, license, output-protection, and decode failures instead of collapsing them into “video error.”

Use HLS stream monitoring for playlist and segment health, then add the protected client step. The viewer authorization guide covers page access; it does not replace key or license authorization.

HLS encryption FAQ

Is HLS AES-128 the same as DRM?

No. AES-128 encrypts complete HLS segments and relies on secure key delivery. DRM additionally provides a key-system license workflow, client content-decryption module, policy enforcement, and a device-specific trust model.

How often should an HLS key rotate?

There is no universal interval. Choose it from rights policy, event length, threat model, player behavior, and the proven ability of the key service and CDN path to carry transitions safely.

Can the encryption key be cached?

RFC 8216 permits a key response to carry an expiry time, but the production policy must match authorization and revocation needs. Never let a shared cache ignore user or entitlement variation.

Why does a segment return 200 but still fail?

The player may have the wrong key or IV, lack an applicable license, receive incompatible signaling, or fail to decrypt or decode the protected samples. Preserve the playlist and client error around the first bad segment.

Review the HLS delivery contract Define the DRM and license boundary Test the supported Web Player output