· 7 years ago · Aug 02, 2018, 12:42 PM
1SecretKeySpec secretKey = new SecretKeySpec(key, "AES");
2Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
3cipher.init(Cipher.ENCRYPT_MODE, secretKey);
4String result = DatatypeConverter.printHexBinary(cipher.doFinal(test));
5
6var crypto = require('crypto');
7var mykey = crypto.createDecipher('aes-256-cbc', key);
8var mystr = mykey.update(value, 'hex', 'utf8')
9
10Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt
11 at Decipher.final (internal/crypto/cipher.js:104:26)
12 at evalmachine.<anonymous>:12:16
13 at Script.runInContext (vm.js:74:29)
14 at Object.runInContext (vm.js:182:6)
15 at evaluate (/run_dir/repl.js:133:14)
16 at ReadStream.<anonymous> (/run_dir/repl.js:116:5)
17 at ReadStream.emit (events.js:180:13)
18 at addChunk (_stream_readable.js:274:12)
19 at readableAddChunk (_stream_readable.js:261:11)
20 at ReadStream.Readable.push (_stream_readable.js:218:10)