Hi,
My plugin is exporting a gzipped file containing all the settings for the plugin. I also have a gzipped file containing all resources like pictures etc
I struggle to have those files encryped with the JUCE Blowfish class.
I have my files properly converted to gzip. That part is working perfectly. I tried encrypting the datas before gzipping them and after from the file content itself.
none solution worked. I get a 0byte file.
I am wondering if it’s coming from the key length? It has to be 32bytes or can it be smaller?
This is the snippet of the code where once the files are created as gzip I read their content and encrypt them in a new file (file is created but is empty) :
// Encrypt the Gzipped panel file as a new Blowfish encrypyted derived file
File fileToEncrypt = File::getSpecialLocation(File::currentApplicationFile).getChildFile("Contents/Resources/"+String("SettingsZ"));
File fileEncrypted = File::getSpecialLocation(File::currentApplicationFile).getChildFile("Contents/Resources/"+String("SettingsZBF"));
if (fileToEncrypt.existsAsFile()) {
// Read file contents into a MemoryBlock
MemoryBlock dataToEncrypt;
fileToEncrypt.loadFileAsData(dataToEncrypt);
// Define the BlowFish encryption Key as string
String keyString = "azerty"; // your_blowfish_key. Replace with your actual key
// Key is provided, proceed with encryption
BlowFish blowfish(keyString.toUTF8(), keyString.getNumBytesAsUTF8());
// Encrypt the data in-place
blowfish.encrypt(dataToEncrypt);
// Encrypted data needs to be written to the file fileEncrypted
fileEncrypted.create();
FileOutputStream fos (fileEncrypted);
fos.write (dataToEncrypt.getData(), dataToEncrypt.getSize());
fos.flush();
}
I don’t know why it’s not working I should be missing something in the data format conversion or else, I should at least get gibberish content in the file.
Thanks for your help!
Damien
