Skip to main content

Get content keys for your packager

This article is a part of the DRM Quick Start guide, DRM-only path.

Your packager encrypts each video with a content key. It gets that key from the Axinom DRM Key Service over one of the supported protocols, and the Key Service derives the key from the key seed of your environment. Later, the License Service reconstructs the same key from the key ID alone, which is why you never store the key yourself.

Pick the section that matches your packager.

Widevine Common Encryption (self-service)​

This JSON-based protocol is used by Shaka Packager and several other packagers, and it works for Widevine, PlayReady, and FairPlay keys alike. Requests are signed with credentials that you create yourself.

Create signing credentials​

In the Management System, go to Admin Settings / DRM Service and open Widevine Common Encryption API. Click Add Widevine Common Encryption API Credentials, enter a Provider Name of your choice, and click Proceed.

The Signing Key and Signing IV are generated for you when you save. Copy both with their copy buttons; the key stays masked on screen.

Try a request​

Open the Widevine Common Encryption Tool.

  1. Enter your Provider Name, Signing Key, and Signing IV.
  2. Pick a sample request and click Sign.
  3. Enter the CENC URL from your DRM Service page as the endpoint and click POST.

A successful response has "status": "OK" and returns, per track, a key_id, the key, and a PSSH box.

Hex or base64

The Management System copies the signing key and IV in base64. The tool currently expects both as hexadecimal strings. Convert before pasting, for example on macOS or Linux: echo 'PASTE_BASE64' | base64 -d | xxd -p -c 256. Your packager may accept either format; check its documentation.

Use it in your packager​

Point your packager at the same CENC URL with the same three values. Integration with Shaka Packager shows a complete command line.

SPEKE, Harmonic, Anevia, Broadpeak (service account)​

These protocols send an Authorization header with every key request. In a Mosaic environment, you authorize them with a service account of the environment.

Create a service account​

  1. In the Mosaic Admin Portal, create a service account for your environment, as described in How to Authenticate a Service Account.
  2. Copy the Client ID and the Client Secret. The secret is shown only once.
  3. Open the Permissions of the service account and grant the Admin permission of the DRM Service.

You do not need a Key Service Tenant ID; the service account already belongs to your environment.

Try a request​

Open the SPEKE Tool and select Mosaic Access Token.

  1. Generate an access token for your service account with Generate Access Token in the Admin Portal, and paste it into the tool.
  2. Enter the Speke or Speke V2 URL from your DRM Service page, pick a sample request, and send it.

A successful response is a CPIX document that contains the content keys.

Use it in your packager​

Most packagers cannot request access tokens themselves. Enter the Client ID of the service account as the user name and the Client Secret as the password, and use the same Key Service URL. The Key Service requests the access token on your behalf. See Key Service Management API Authorization for all methods and their details.

The encoder guides walk through the specifics: AWS MediaPackage and MediaLive, AWS MediaConvert, Harmonic, Anevia, Broadpeak.

Caution

The Client Secret cannot be recovered if you lose it; you can only reset it to a new value. Store it in your secrets manager, not in job definitions or source code.

Management key

If your packager cannot use the service account credentials, request a Key Service management key from Axinom Support. State the name of your environment and the protocol you use.

Keep the key ID​

Whatever the protocol, note the key ID of every video you protect. Your entitlement messages name key IDs, and that is how the License Service knows which key to issue. With some encoders the key ID is not obvious; see SPEKE keyId Override and SPEKE Key ID Extraction.

Next steps​

See also​

Was this page helpful?