EZDRM - Fairplay
1Use EZDRM CPIX API to create your content encryption keys
Get response from the following url:
https://cpix.ezdrm.com/KeyGenerator/cpix.aspx?k=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX&u=username&p=password&c=resourcename&m=2
URL params described below:
Parameter | Description |
---|---|
k= | Key ID value (client generated) in GUID format |
u= | EZDRM account username or email |
p= | EZDRM account password |
c= | Content Resource ID (such as a stream name or media asset name) |
m=0 or not provided | Default (returns all available keys) |
m=1 | Widevine and Playready |
m=2 | Fairplay |
2Get your content encryption keys from EZDRM XML response
EZDRM XML response example shown below:
<cpix:CPIX id="bunny">
<cpix:ContentKeyList>
<cpix:ContentKey kid="297f600f-1234-1234-b060-2ac13cc42585" explicitIV="KX9gDxI0EjSwYCrBPMQlhQ==">
<cpix:Data>
<pskc:Secret>
<pskc:PlainValue>aqXCOgIfS78MTFx02XUQhg==</pskc:PlainValue>
</pskc:Secret>
</cpix:Data>
</cpix:ContentKey>
</cpix:ContentKeyList>
<cpix:DRMSystemList>
<cpix:DRMSystem kid="297f600f-1234-1234-b060-2ac13cc42585" systemId="94ce86fb-07ff-4f43-adb8-93d2fa968ca2">
<cpix:URIExtXKey>
c2tkOi8vZnBzLmV6ZHJtLmNvbS87Mjk3ZjYwMGYtMTIzNC0xMjM0LWIwNjAtMmFjMTNjYzQyNTg1
</cpix:URIExtXKey>
</cpix:DRMSystem>
</cpix:DRMSystemList>
</cpix:CPIX>
You need to provide three params to Qencode API in order to enable DRM encryption:
- key: you need to get pskc:PlainValue xml tag content, decode it from base64 format and convert to hex. Here's a line in python you can use for that:
>>> 'aqXCOgIfS78MTFx02XUQhg=='.decode('base64').encode('hex')
'6aa5c23a021f4bbf0c4c5c74d9751086'
So in our example hex key value will be 6aa5c23a021f4bbf0c4c5c74d9751086.
- iv: you need to get explicitIV attribute value from cpix:ContentKey xml tag, decode it from base64 format and convert to hex. Here's a line in python you can use for that:
>>> 'KX9gDxI0EjSwYCrBPMQlhQ=='.decode('base64').encode('hex')
'297f600f12341234b0602ac13cc42585'
So in our example hex iv value will be 297f600f12341234b0602ac13cc42585.
-
key_url: this should be in the following format
skd://fps.ezdrm.com/;<kid>
So in our example key_url will be
skd://fps.ezdrm.com/;297f600f-1234-1234-b060-2ac13cc42585
3Add a 'fps_drm' object to your Qencode API request JSON
In our example it will be as follows:
"fps_drm" : {
"key" : "6aa5c23a021f4bbf0c4c5c74d9751086",
"iv" : "297f600f12341234b0602ac13cc42585",
"key_url" : "skd://fps.ezdrm.com/;297f600f-1234-1234-b060-2ac13cc42585"
}
You need to add 'fps_drm' object as a direct child of the format object. Here's the full example:
{
"query": {
"source": "https://yourserver.com/video.mp4"
"format": [
{
"output": "advanced_hls",
"destination": {
...
},
"stream": [
{
"size": "640x360",
"audio_bitrate": "128"
},
{
"size": "852x480",
"audio_bitrate": "128"
},
{
"size": "1280x720",
"audio_bitrate": "320"
}
],
"fps_drm" : {
"key" : "6aa5c23a021f4bbf0c4c5c74d9751086",
"iv" : "297f600f12341234b0602ac13cc42585",
"key_url" : "skd://fps.ezdrm.com/;297f600f-1234-1234-b060-2ac13cc42585"
}
}
]
}
}