I am inexperienced with symmetric encryption. I am encrypting a pdf file in php using the following code:
$source_filepath = RB::get('docroot') . RB::get('baseUrl') . '/submissions/' . $this->_filename;
$encrypted_filepath = $source_filepath . '.nc';
$pdf_data = file_get_contents($source_filepath);
$encrypted_data = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, '1234567812345678', $pdf_data, MCRYPT_MODE_ECB);
file_put_contents($encrypted_filepath, $encrypted_data);
Then I need to decrypt it outside of php, potentially using a desktop application/utility on another computer. I have attempted to decrypt the file with the aescrypt utility (http://www.aescrypt.com/) which tells me:
"Error: Bad file header (not aescrypt file or is corrupted? [c, fffffff0, fffffffe])"
as well as the mcrypt command which tells me: File thefile.pdf.nc was NOT decrypted successfully.
I have yet to be able to decrypt anything encrypted with encrypt outside of php. I have tried using blowfish and decrypting it with bcrypt (http://bcrypt.sourceforge.net/) as well with similar results. I suspect my ignorance of how encryption works is to blame but any help or education would be appreciated. Thanks.