I have a mysql dump file which is Gzipped and then encrypted in OpenSSL.
openssl enc -aes-256-cbc -e -in input.gz -out output.gz.enc -pass pass:"some_pass_phrase"
when I try to decrypt it using NodeJS I get a corrupt file that I cannot unzip.
function decryptBackupFile() {
var enc_key = GetEnvironmentVariable("ENC_KEY");
var input = fs.createReadStream('/Users/afiku/Documents/input.sql.gz.enc');
var output = fs.createWriteStream('/Users/afiku/Documents/output.sql.gz');
var decrypt = crypto.createDecipher('aes-256-cbc', enc_key);
decrypt.setAutoPadding(false);
input.pipe(decrypt).pipe(output);
output.on('finish', function(){
console.log('Finished unarchiving');
});
}
I didn't get any error or exception and the resulting file is a bit smaller than the encrypted file.
the passphrase is correct. I tried decrypting it using openssl in bash and it worked...
what am I doing wrong?
via Afiku
No comments:
Post a Comment