I'm using the following command to encrypt a video file in openssl
openssl aes-256-cbc -nosalt -a -in movie.mp4 -out movie.enc -k skdjfsldkfjsldkjfsldkf
And using the following code to decrypt the file but I keep getting bad decrypt error what am I doing wrong?
var crypto = require('crypto');
var fs = require('fs');
cipher_name = 'aes-256-cbc';
password = 'skdjfsldkfjsldkjfsldkf';
decoder = crypto.createDecipher( cipher_name, password );
text_crypt = fs.readFileSync( 'movie.enc' );
chunks = [];
chunks.push(decoder.update( text_crypt, 'binary' ));
chunks.push(decoder.final( 'binary' ));
fs.writeFileSync( 'nodemovie.mp4',chunks.join('','binary') );
This is the error I'm getting
Error: error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length
at Decipher.final (crypto.js:160:26)
at Object.<anonymous> (F:javaindex.js:12:21)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.runMain (module.js:605:10)
at run (bootstrap_node.js:427:7)
at startup (bootstrap_node.js:151:9)
I should be able to encrypt video in openssl and decrypt in node and java at the same time
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…