Encrypt media segments at the edge

Media encryption encrypts individual media segments on the way out to the client, with Akamai acting as the key server. Nothing is pre-encrypted on your origin, and nothing changes in your packaging pipeline — the encryption is applied per playback session during delivery.

It's part of the Segmented Media Protection behavior that your environment already carries, switched off by default.

When to use this

  • You want a layer of protection above token authentication but don't need full DRM.
  • You can't or don't want to run a key server.
  • Your content is served on demand, or live through Media Services Live, in HLS or DASH.

Media encryption is not a substitute for DRM. It limits access to clients holding a decryption key; DRM adds rights management rules and authorized playback environments.

How it works

  1. Information about the decryption key is included in the media manifest.
  2. The player processes the manifest and requests the key.
  3. Akamai, acting as the key server, provides the key if the user is authenticated and authorized.
  4. The client decrypts and plays the segments.

Encryption is session-level. The stream is encrypted per user playback session based on the stream, user, and time or date. Every new request for a stream counts as a session, keys are created per session and sent dynamically, and two users watching the same asset get different keys.

Before you begin

  • Add token authentication too. Media encryption protects the content; token auth protects access to the key file. Both live in Segmented Media Protection. See Protect streams with token authentication.
  • Serve over HTTPS. HTTP connections aren't supported for keys, manifests, and playlists. Segments can travel over HTTP between your origin and edge servers, but securing the whole path is the recommendation.
  • Check your delivery mode. Supported with On Demand, and with Live when the origin is Akamai Media Services Live.

Set up media encryption for HLS

Player requirements

RequirementDetail
HTTPSReduces the risk of a man-in-the-middle attack against the encrypted stream. See Prepare your edge certificates and Prepare your origin server.
Manifest specificationManifests must comply with the HTTP Live Streaming Protocol Specification. Deviations break media encryption.
AES-128The only supported cipher. Your player must support it.
Akamai as key serverThird-party key servers aren't supported. Enabling the feature sets Akamai as your key server — there's nothing else to do.

Configure it

  1. In Segmented Media Protection, set HLS Encryption to On.
  2. Enable Token Authentication in the same behavior, so access to the key file is protected by long tokens.
  3. Save.
🚧

The initialization vector is now automatic

Earlier versions of media encryption for HLS let you define an Initialization Vector manually. The current version generates one per session instead. If you're upgrading from the old version and go live, in-flight streams that use the old initialization vector will fail in the player.

If you use a path match

When media encryption lives in a custom rule set that matches on specific paths, add the key file path as a path match too:

/serve.key

The manifest always looks to /serve.key for the key. Without that path match, edge servers don't find the media encryption behavior when the key is requested, the key isn't generated, and the stream fails.

Caveats for HLS

IssueDescription
Byte-range playlists aren't supportedByte ranges can be reported incorrectly in the playlist. When the player switches bitrates it may fail to append the new segment to its buffer — playback failures and audio/video sync issues follow.
Existing stream-level encryption passes throughContent already encrypted on your origin, for example by a DRM system, isn't encrypted again. It's passed through as-is.

Set up media encryption for DASH

📘

Limited Availability

Media encryption for DASH is available to selected customers only. Talk to your account team about eligibility.

Supported players

Currently the DASH.js reference player (DASH-IF Reference Client).

Player requirements

RequirementDetail
HTTPSSame as HLS — keys, manifests, and playlists aren't served over HTTP.
Clear Key DRMThe player needs Clear Key support, per W3C Encrypted Media Extensions.
AES-128 modeContent must use the cenc or cbcs protection scheme. To override the default cbcs per request, have the player send aka_dme_enc=cenc. To override it consistently, use the Advanced behavior — contact Akamai Professional Services.
SegmentTemplate onlySegmentBase and SegmentList manifests aren't supported.
Akamai as key serverThird-party key servers aren't supported.

Configure it

  1. In Segmented Media Protection, set DASH Encryption to On.
  2. Enable Token Authentication in the same behavior.
  3. Save.

If you use a path match

Add the DASH key file path as a path match in the rule:

/AcquireLicense

Without it, edge servers won't locate the media encryption behavior when the license is requested, and the stream fails.

Caveats for DASH

IssueDescription
Byte-range playlistsSame problem as HLS — incorrect byte ranges on bitrate switches.
SegmentTemplate identifiers in a segment pathIdentifiers such as $Number$, $Time$, or $RepresentationId$ are variable, so signature validation fails if they appear in the path. They're fine in the filename. Supported: /<path>/$Number$-manifest.mpd. Not supported: /<path>-$Time$/$Number$-manifest.mpd.
Existing stream-level encryption passes throughPre-encrypted content is delivered as-is.
HTTP/2 isn't supportedClients fetching DASH segments with media encryption enabled have hit HTTP2 FRAME SIZE ERROR.
Partial object caching isn't supportedPartial object caching fetches a segment as a series of range requests, and the encryption logic doesn't handle ranged content.
Bit Rate Limiting isn't supportedBuffer issues. See Cap the rate at which content is served.
Live playback distortion on FirefoxVideo distortions have been seen with encrypted DASH on Firefox, sometimes at the start and improving, sometimes minutes in.
BaseURL in the manifestMedia encryption doesn't work when a BaseURL tag is present. Signature generation needs a canonical base path, and the BaseURL value isn't currently taken into account.
AcquireLicense CORS failureA Clear Key license request can fail when it's accompanied by a CORS request, because the player expects Content-Type in Access-Control-Allow-Headers. Fix: open the Default CORS Policy rule, find the Modify Outgoing Response Header behavior with Access-Control-Allow-Headers as the header name, and add Content-Type to New Header Value.
"DRM: unable to create session!"Seen intermittently in the DASH.js player with Clear Key. Refresh the player and retry. See the GitHub issue.
Hostname override isn't supportedMedia encryption doesn't work for DASH if the environment sets a hostname override with AKA_PM_TO_BE_ENCRYPTED_HOSTNAMES.
HEVC / H.265 isn't supportedThe supported video compression standard is H.264 / MPEG-4 Part 10.
Standard formats such as Azure aren't supportedN/A
CMCD prefetching isn't supported with media encryption for DASHSee Prefetch the next segment.

Related


Did this page help you?