-->

Java code to decrypt the node.js encrypted string

2019-09-19 06:42发布

问题:

I have a server which encrypts the some data using

var key = new Buffer('Kay8u5Dev5al7', 'utf-8');

var encrypt = function(key, data) {
    var cipher = crypto.createCipher('aes256', key);
    var crypted = cipher.update(data, 'utf-8', 'hex');
    crypted += cipher.final('hex');
    return crypted;
}

Now I want to decrypt the data back using a java client.

Though I referred some examples to decrypt in java I could'nt get the data back. I am using JCE security jars at the client side.