3

I have a value encrypted with cryptoJS (AES) and need to decrypt using Erlang crypto library. The problem for me lies in the fact that to be able to decrypt in Erlang using aes_cbc_128_decrypt(Key, IVec, Cipher) I presume, I will need to know what the IVec is that was used and how the Key should be made up.

var ciphertext = Crypt.AES.encrypt("message here", "4445");  
// U2FsdGVkX1+ZxppJRvcbdWJW1xAxSlm2akm7ZFnY9GU=
Artjom B.
  • 61,146
  • 24
  • 125
  • 222
blackbox
  • 31
  • 1
  • You would have to implement the [`EVP_BytesToKey`](https://www.openssl.org/docs/manmaster/crypto/EVP_BytesToKey.html) and derive the key and IV from the password and the salt that is included in the ciphertext (decoded bytes 8-15 (0-indexed)). I found [this](https://github.com/Yongke/shadowsocks-erlang/commit/933a5bb383267ba29c8378fb5d66d29f9434c173#diff-71261a4477a27c06012918360a54332cR121), but it looks wrong. – Artjom B. Dec 31 '15 at 08:34

1 Answers1

0

IVec = <<0:128>>, and the length of the key should be a multiple of 16.

Jack Liu
  • 47
  • 4