Create and sign a license service message
This article is a part of the DRM How-to Guides.
Before you can send an Entitlement Message to the License Service, you have to wrap it into a so called License Service Message and make a signed JWT token out of it.
License Service Message is a JSON data structure used as an envelope. Here is a minimalistic version (additionally, you can specify a time period of validity of the enclosed Entitlement Message):
{
"version": 1,
"com_key_id": "YOUR_COMMUNICATION_KEY_ID",
"message": {YOUR_ENTITLEMENT_MESSAGE}
}
Replace "YOUR_COMMUNICATION_KEY_ID" with the value from your DRM configuration, and {YOUR_ENTITLEMENT_MESSAGE} with the Entitlement Message JSON object you generated in the previous section.
With the Mosaic DRM Service, find the Key ID under Admin Settings / DRM Service / Communication Key in the Management System; with a DRM configuration in Axinom Portal, check My Mosaic / DRM.
If you have a legacy agreement, your environment has no DRM Service page. You find the Key ID and the key value in the Axinom Portal and in your configuration PDF instead, as described in Legacy agreement credentials.
We highly recommend also setting a short expiration_date to limit unintended re-use of the tokens.
To create a JWT, use the License Service Message above as a payload and sign it with HMAC-SHA256 algorithm using your Communication Key as a signing key. Then apply base64 encoding.
The easiest way to do it: copy your JSON to the DRM Video Playback Tool under "License Service Message" and click the "License Service Message -> JWT" button (add your Communication Key and Communication Key ID to the corresponding fields).
To generate a JWT programmatically, check Signing a License Service Message article. It shows how to create and sign the JWT in many programming languages, including JavaScript, C#, PHP, Python, Rust, Go, C++, Swift, Scala, Java.
To send your JWT to Axinom DRM License Service use one of the methods described in License Service Message.
Next steps​
See also​
- License Service Message - definition of the data structure; how to send it to a License Service
- DRM Video Playback Tool - allows to create and sign a JWT based on your JSON and communication key
- Signing a License Service Message - how to create a License Service Message, convert it to JWT and sign programmatically with examples in many programming languages