Node Crypto AES decrypt issue

19 views
Skip to first unread message

Soham Gupta

unread,
Sep 7, 2016, 5:02:37 PM9/7/16
to nodejs

We have been provided with an encrypted text and a passphrase. Along with that they have informed that the text has been encrypted using AES-128

Encrypted Text - 5vCGQXtdj7GZtwwhwVOquSyR/qvs95ojBsmOf9DX6T31Y2yTIvjXYHf6gd8icDaY Passphrase/password - FX4DqkZCb4KI6BWF

Expected O/P - e23f95c7-79c2-4c6f-9408-411bcfaf3665

Now when I decrypt online from http://aesencryption.net/ It does generate the Guid, However, it does not work with any other online tool.

Also, I need to implement the same in Node Js. I have used the code mentioned below, but still that does not work and thus generate unwanted data.


var aesDecrypt = (text, password, bit) => {
var crypto = require('crypto');
var decipher = crypto.createDecipher('aes-' + bit + '-cbc', password);
decipher.setAutoPadding(false);
var plaintext = decipher.update(text, 'base64', 'utf8');
var token = plaintext.toString();
return token;
}

Reply all
Reply to author
Forward
0 new messages