Hello everyone,
I’d like to allow users to download my audio files, but with some encryption to avoid copyright issues. I don’t even know how to start with this, or even how to encrypt it first. Some thoughts?
Thanks.
daniel
November 9, 2020, 2:02pm
2
That is a broad question. Did you start with a forum search? Search results for 'audio encryption' - JUCE
Hi there,
What would be an easy approach to save a file as an encrypted file, and decrypt it again? The encryption doesn’t need to be strong, just so the user cannot open it.
thanks.
I would suggest to inherit an InputStream and OutputStream. You can give them to any AudioFormatReader, and you have all freedom, if you get your encrypted data from a File, a MemoryBlock, or anything, even from a GZIPDecompressorInputStream…
You need to implement only 5 methods:
virtual int64 getTotalLength ()
virtual bool isExhausted ()
virtual int read (void *destBuffer, int maxBytesToRead)
virtual int64 getPosition ()
virtual bool setPosition (int64 newPosition)
Looks like only t…
I invented a very trivial sample obfuscation algorithm for low CPU usage (I was probably not the first to come up with that):
Create a noise file that you ship with the samples. This is your public key
Mix that noise with your sample with an offset (individual for each sample, makes it a bit harder)
when playing back sum the negative noise with the correct offset. Summing is cheap.
Caveat: make sure that your wave file accepts values over 1.0f (since you cannot rule that out).
To get you some starting points. It is a tradeoff between more security vs. CPU usage to read the samples.