Kodi Community Forum
Play encrypted (AES128) file in kodi? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Play encrypted (AES128) file in kodi? (/showthread.php?tid=364878)



Play encrypted (AES128) file in kodi? - markg85 - 2021-10-11

Hi,

As far as i know, KODI internally uses FFmpeg. They have the "crypto" protocol which allows playback of encrypted videos.

To give a bit of a feel of how this works, i'll demonstrate exactly how this is done in ffmpeg.

First, we generate the AES key and IV (Initialization Vector):
Code:
export AES_KEY=$(openssl rand -hex 16)
export AES_IV=$(openssl rand -hex 16)
Store thee in a file somewhere (you can see them by typing "env" and looking for "AES_KEY" and "AES_IV"), you need them both later on to play the file.

Then we encrypt a video file using openssl and this command:
Code:
openssl enc -aes-128-cbc -K $AES_KEY -iv $AES_IV -in <VIDEO> -out <VIDEO>.enc
Change '<VIDEO>' to your file.

Now you can play this encyrpted file in ffplay (also works in vlc):
Code:
ffplay crypto://<video>.enc -decryption_key $AES_KEY -decryption_iv $AES_IV
This demonstrates the playback of encrypted files using ffmpeg, just so that we've verified that this actually works Smile

I now want to be able to play this encrypted file in KODI, but how?
I'm looking for a way to instruct KODI to play the file through the "crypto" protocol.
I'm also looking for a way to set the AES key and IV as those will be quite hard requirements to get this working at all.

Any help would be greatly appreciated!

Best regards,
Mark


RE: Play encrypted (AES128) file in kodi? - markg85 - 2021-10-12

Funny when reading it back. I made a few typos, lol.
Can't change them apparently. Probably because it's the main topic post?

Anyhow, bump. I'm now also looking into the route of patching the addon "inputstream.ffmpegdirect" to make this possible. I still hope it already is possible and i just don't know how yet Smile