0

I am getting an encrypted text on the client side which has been encrypted at server(with java) using AES-256 bit , and SHA-256 (2048 bit), i have no idea how to decrypt it. (provided that i am having a key at the client side which has been used at server side for the encryption purpose and i am using symmetric key cryptography).

i am using SJCL for this and have tried this code

decodedData = sjcl.decrypt(key,encryptedData);

but it is giving the error

"json decode: this isn't json! "

if you can suggest any other library(along with the code will be better).

any help will be greatly appreciated.

EDIT-

yes i was using the SHA-256 as key for AES-256, but going further i will not use SHA-256 so now i need the answer only for how to decrypt the data which has been Encrypted with AES-256 .

EDIT-

i tried it with pidcrypt since the data which i was trying to decrypt was encrypted using cbc mode that sjcl doesn't have but picrypt, i tried the following code

var data = "IFoRnqsmfPN9qKXu+oIKTIZxj1nRyVKP0FjGqefBZ8BMZ0ocBv9Hhfg560lM+CZhg00Yk29bn+/U5kOYNV9nSeTwdJTeXFX2H+m7ttE++1cJ7fjeYEiJv1JMvFRWm/PTZbmcmy+0pgXzuCzF0R3AEmEIuD+tpOX/Knc1FODIRNYb2yxKNW2iNRVKq9g/Qyuqn6w5Bp1cfdnTHNcNZL+GMHKoimKswgxPsR6NfbR/BMs";

var key  = "fdgfg787kim9om89";

var aes = new pidCrypt.AES.CBC();
var decryptedData = aes.decryptText(crypted, key);

but it is returning null(no error), any guess what is wrong with this?

Novice
  • 401
  • 7
  • 27
  • Do you mean _signed_? These look like the specs for a signing algorithm, not an encryption one. Signing cannot be reversed, it can only be used to verify the signer. – Boris the Spider Jun 02 '14 at 11:03
  • @dystroy I guess he uses SHA-256 as a key for AES, which could be decrypted. – VisioN Jun 02 '14 at 11:06
  • Have you read the documentation? Seems like you just pass the wrong kind of data into the function – Niklas B. Jun 02 '14 at 11:18
  • @NiklasB. yeah you are right, this library requires the encrypted data in json format(like {"iv": "..", "ks":".."}) but the data which i am getting from server is not in json format. what should i do now? – Novice Jun 02 '14 at 11:21
  • @akshay I can't tell you, but the documentation hopefully has something to say about what the parameters mean. Also you might need to use the lower-level APIs. – Niklas B. Jun 02 '14 at 13:05

0 Answers0