Closed GoogleCodeExporter closed 9 years ago
You'll have to do some extra work to make mcrypt and CryptoJS compatible. At
minimum, you need to consider the ciphertext format, key generation, and
padding. CryptoJS's ciphertext format, by default, matches OpenSSL's format,
which is the string "Salted__", followed by a 64-bit salt, followed by the raw
ciphertext. Mcrypt doesn't parse that format on its own. You'll have to parse
it yourself, or format CryptoJS's output to something mcrypt expects. You also
need to make sure that the key is being generated in the same way on both ends.
CryptoJS, by default, uses OpenSSL's BytesToKey algorithm. Mcrypt doesn't do
any key generation. And, finally, CryptoJS uses PKCS5 padding by default,
whereas mcrypt will zero pad. For more information, see the discussion for this
topic: https://groups.google.com/forum/#!topic/crypto-js/YLKt6es-h1w
Original comment by Jeff.Mott.OR
on 1 Oct 2012 at 8:31
Original comment by Jeff.Mott.OR
on 1 Oct 2012 at 6:29
Original issue reported on code.google.com by
ivan.s...@gmail.com
on 1 Oct 2012 at 7:56