I want to decrypt a file in nodejs, and I have this function so far :
var fileDecrypt = function(inputFile, outputfile, password) {
var algorithm = 'aes-128-cbc';
var data = fs.readFileSync(inputFile, {encoding:'base64'});
const iv = "SKYGEDANNECY1234"
console.log(data);
var decipher = crypto.createDecipheriv(algorithm,Buffer(password, 'hex'),Buffer.from(iv, 'hex'));
decipher.setAutoPadding(false);
var dec = decipher.update(data,'base64','utf-8');
dec += decipher.final();
console.log(dec);
},
The problem is when I run it I get this error :
When am I doing wrong here ?
question from:
https://stackoverflow.com/questions/65887330/cant-decrypt-a-file-in-nodejs-aes-128-cbc 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…