How to protect your music through encryption |
|
Protecting music from fraudulent uses and from copyright infringements is a must for many authors and distributors: currently you could already use your own or third-party encryption/decryption schemas and load decrypted song's data through the LoadSoundFromMemory method; as a second alternative, you could also compress your songs into one or more ZIP files, protected with an AES encryption key, and use Audio DJ Studio for .NET in order to extract zipped songs directly into a memory buffer through the LoadSoundFromZip method (see the How to manage ZIP files tutorial for details about ZIP files management).
Audio DJ Studio for .NET comes also with its own proprietary solution that allows encrypting songs, for safe redistribution purposes, using our CryptSound™ application.
Once encrypted, no available multimedia application will be able to playback these songs while applications developed using Audio DJ Studio for .NET will be able to load encrypted songs through one of the following methods:
• | LoadEncryptedSound: loads and decrypts an encrypted sound file from disk: all operations are performed inside the main thread. |
• | LoadEncryptedSoundSync: loads and decrypts an encrypted sound file from disk: all operations are performed inside a secondary thread. |
• | LoadEncryptedSoundFromMemory: loads and decrypts an encrypted sound file stored inside a memory buffer: all operations are performed inside the main thread. |
• | LoadEncryptedSoundFromMemorySync: loads and decrypts an encrypted sound file stored inside a memory buffer: all operations are performed inside a secondary thread. |
For security reasons, the CryptSound™ application is currently not installed with our trial version setup package: if you need to test its encryption capabilities, please, contact us and we will ask you to upload inside our FTP server one of your songs; at this point we will send you back the encrypted song with a dedicated decryption key that will have to be passed to the LoadEncryptedSound method: as a fast testing start, we have provided a small sample also, called SecureSongs.exe, that will give you the possibility to test the encrypted song directly on your PC without the need to create a test application from scratch.
The CryptSound™ application has two working modes:
• | With its own user interface |
Launching the application without any command line parameter will display the user interface as shown on the screenshot below:
As you can see, this user interface is very straightforward and intuitive; the complete sequence of operations is the following:
• | fill the "List of files to encrypt" list using the "Add file..." and/or "Add directory..." buttons |
• | remove any unwanted file selecting its pathname inside the list and pressing the "Remove file" button. |
• | select the destination directory for encrypted output files: if not specified, the encrypted output file will be placed inside the same folder of the input file, with the same filename and extension changed with the string contained inside the "Encrypted files extension" edit box |
• | optionally change the default extension for encrypted output files filling the "Encrypted files extension" edit box |
• | fill the "Encryption key" edit box with your own key (from 16 to 32 characters) or, in alternative, let the application generate a unique key for you pressing the "Generate new key" button |
• | if needed, check the "Add header containing information about the sound file" checkbox: this will allow adding a small header to each encrypted file containing a few information about file contents (duration, author, title, etc.) |
• | if needed, check the "Store output encrypted files ... etc." checkbox: this will allow storing each encrypted file into a separate sub-folder whose name will reflect the "genre" of the song taken from an eventual ID tag (for example "Rock", "Rock & Roll", "Country", etc.). If for example the song's genre should be "Rock & Roll", by using settings displayed on the picture above a generic "filename.mp3" song after being encrypted would be stored inside the following pathname: "C:\m_sounds\audio\encrypted\Rock & Roll\filename.bin" |
• | press the "Start encryption" button and wait for the "Encryption completed" message. |
• | From the command line for use with batch files |
Launching the application from the command line requires the following syntax:
CryptSound "InputFileFullPathname" -k="EncryptionKey" [-p="PreviousEncryptionKey"] [-o="OutputFileFullPathname"] [-i] [-s]
were:
"InputFileFullPathname" |
Full pathname for the input file |
||||||||||||||||||||||||
-k="EncryptionKey" |
The key used to encrypt the file: must be from 16 to 32 characters long |
||||||||||||||||||||||||
-p="PreviousEncryptionKey" |
(Optional parameter) Previous encryption key, allows to open and decrypt a previously encrypted file and to re-encrypt it using the new key specified inside the -k parameter |
||||||||||||||||||||||||
-o="OutputFileFullPathname" |
(Optional parameter) Full pathname for the output file; if not specified and if the "-f" parameter has not been specified as well, the output file will be placed inside the same folder of the input file, with the same filename and the extension changed into ".bin" |
||||||||||||||||||||||||
-f="OutputPath" |
(Optional parameter) Output folder where encrypted file will be placed; if not specified, the output file will be placed inside the same folder of the input file, with the same filename and the extension changed into ".bin". This parameter is ignored if the "-o" parameter has been specified. |
||||||||||||||||||||||||
-i |
(Optional parameter) Allows performing analysis of the original sound file before encryption in order to add a small header to each encrypted file containing a few information about file contents; this feature is useful when adding encrypted songs to a playlist. Supported fields are the following:
(*) only compiled if corresponding tag field is available inside the original sound file |
||||||||||||||||||||||||
-g |
(Optional parameter) Put the encrypted output file inside a sub-folder named as the eventual genre of the sound file (only if the "-i" option has been specified and the "-o" option is not available). This parameter is ignored if the "-i" parameter has not been specified. |
||||||||||||||||||||||||
-s |
(Optional parameter) Silent mode |
below two examples of use:
CryptSound "c:\mp3_sounds\myfile.mp3" -k="ABSF1SHR46KFL0JVH6E8JFG49KMD3H28"
The sample above will encrypt the "c:\mp3_sounds\myfile.mp3" file using the "ABSF1SHR46KFL0JVH6E8JFG49KMD3H28" encryption key and the output will be placed inside the "c:\mp3_sounds\myfile.bin" file
CryptSound "c:\mp3_sounds\myfile.mp3" -k="ABSF1SHR46KFL0JVH6E8JFG49KMD3H28" -o="c:\mp3_sounds\encrypted\myfile.zzz"
The sample above will encrypt the "c:\mp3_sounds\myfile.mp3" file using the "ABSF1SHR46KFL0JVH6E8JFG49KMD3H28" encryption key and the output will be placed inside the "c:\mp3_sounds\encrypted\myfile.zzz" file