Encrypt / Decrypt video files to play only in my custom made video player
-
I want to encrypt video files and make custom video player. Only my custom made video player can decrypt and play encrypted video files. I am using QMediaplayer. I will use most of the functionality from QMediaPlayer. I just to want to encrypt and decrypt using custom player.
Please give some hint or link.
-
Hi,
What kind of video do you have in mind ?
-
@mit_cruze How secure do you want it? You can use PKE style encryption or even a regular symmetric algorithm. Both of those would be hackable given enough time and desire though.
There are ways to obfuscate the keys since the video player will need to know them, but it's impossible to completely prevent hacking with keys stored locally.
To really secure it you will need to use a key server to help you get keys to decrypt. Still crackable but much much harder.
So really if you just want some simple encryption google "code for blowfish encryption c++" or whatever algorithm you prefer.
Keep in mind you'll need secure memory for your process or when you decrypt your video to play it, someone can grab it. Also you can't cache it to disk at all during decryption which means you may need a large amount of memory for your video player.
-
@ambershark May I have some links or reference of PKE style encryption or even a regular symmetric algorithm?
-
In that case shouldn't you rather setup the encryption at the stream level rather than the video ?
-
@mit_cruze said in Encrypt / Decrypt video files to play only in my custom made video player:
@ambershark May I have some links or reference of PKE style encryption or even a regular symmetric algorithm?
Good news is if you are streaming you can indeed encrypt the stream as @SGaist suggested. And you can keep your keys much more secure since they do not need to be stored client side.
As for links, you can easily find code implementation in google. Some of Bruce Schneier's algorithms are awesome, blowfish, twofish, etc. Check out his website. I posted a link directly to his blowfish code. You may want to look around for other implementations though. His math and encryption/security skills are top notch but his coding is kinda scary, lol. At a bare minimum you'll want to make easy to use classes to wrap the underlying code.
http://www.schneier.com/code/bfsh-sch.zip
As for PKE, there are tons of algorithms there too. It's a complex topic and one that you really shouldn't try to implement yourself without a really strong math background. I would recommend using a library or binary for encryption written by someone who really knows what they are doing. If you want to do it yourself, I recommend bruce schneier's applied cryptography book.
Here is a link to an API that might be worth looking into (Disclaimer: I've never used it, and don't know how good/secure it is):
https://www.cs.auckland.ac.nz/~pgut001/cryptlib/
There's tons out there, just google public/private key encryption algorithms.