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.

4
  • Stack Overflow is not a code translation service. Show the code that you tried and the errors that you received. Commented Oct 28, 2015 at 13:38
  • Note that crypto.createCipher uses a password and not a key. You would need to replicate EVP_bytesToKey in Java. Commented Oct 28, 2015 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. Commented May 12, 2018 at 10:24
  • @dave_thompson_085 Good thing, I've done that already with this answer of mine. Commented May 12, 2018 at 11:27

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.