0

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.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
amith
  • 399
  • 1
  • 2
  • 11
  • Stack Overflow is not a code translation service. Show the code that you tried and the errors that you received. – Artjom B. Oct 28 '15 at 13:38
  • Note that `crypto.createCipher` uses a password and not a key. You would need to replicate `EVP_bytesToKey` in Java. – Artjom B. Oct 28 '15 at 14:08
  • Late but @ArtjomB.: you only need `EVP_BytesToKey` for the case no salt, MD5, and one iteration (!!), which is relatively easy, plus there are several Qs with the needed code if you look. – dave_thompson_085 May 12 '18 at 10:24
  • @dave_thompson_085 Good thing, I've done that already with [this answer](https://stackoverflow.com/a/29152379/1816580) of mine. – Artjom B. May 12 '18 at 11:27

0 Answers0