Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Decrypt and Play CENC protected contents in DASH?

Tags:

mpeg-dash

I have a MPD clip which supports CENC,how to decrypt and play without using any specific DRM engine??Is there any decryption algorithm available to decrypt AES CTR 128 bit?If so will it be used to decrypt MPEG-DASH content?There are some third party libraries available in net like NACL,Openssl,crypto++,which can do AES ctr 128 decryption.Can i use one of them to decrypt DASH Content(CENC supported) ??

like image 551
user3227290 Avatar asked Nov 27 '14 11:11

user3227290


2 Answers

MPEG-CENC is simply AES-128 CTR encryption on an ISO BMFF (mp4) file. The specification for how this is applied to CENC is here: https://www.w3.org/TR/2014/WD-encrypted-media-20140828/cenc-format.html and https://www.iso.org/obp/ui/#iso:std:iso-iec:23001:-7:ed-1:v1

And a good explanation of AES-128 CTR https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation#Counter_.28CTR.29

To decrypt you will need the key and also the Initialization Vector (IV) that was used to encrypt the content. This is available from the senc and tenc boxes in the mp4 file. Once you will have those you will simply need to go through the samples or fragments of the file and decrypt and reassemble the mp4 (assuming you want to play it).

As mentioned by Bento tools mp4decrypt gives an example on how to do this: https://github.com/axiomatic-systems/Bento4/blob/master/Source/C%2B%2B/Apps/Mp4Decrypt/Mp4Decrypt.cpp

like image 192
Andrew Avatar answered Oct 20 '22 11:10

Andrew


DASH videos protected using CENC can be played back using many different DRM technologies. The primary factors you need to care for are:

  • The player used must support the chosen DRM technology. Of the popular browsers, Internet Explorer 11 supports PlayReady and Chrome supports Widevine. For non-browser platforms, various 3rd party players are available.
  • The video must contain metadata that allows the DRM technology to recognize the actions needed in order to decrypt the video (most importantly, the ID of the encryption key and the URL to acquire it from).
  • There must be a service running that will provide the decryption key to the player on demand, after validating that the user is authorized to view the video. Generally, the key is embedded in a data structure called a license which can provide additional data to the player regarding content protection requirements (e.g. "HDCP must be turned on to play this video").

Note that in order to reach a wide spectrum of players, you will need to support multiple DRM technologies simultaneously.

You will find some references to the DRM technologies at the DASH-IF content protection references page.

Note that some browsers may also support the "clearKey" DRM technology, which is a fake implementation that simply takes the decryption key and uses it directly. If you have the decryption key and a video, you can use the clearKey mechanism to play your video.

Edit: If you have the cryptographic key then you can use the mp4decrypt tool from the Bento4 suite to decrypt the fragment files.

like image 5
Sander Avatar answered Oct 20 '22 11:10

Sander