I'm trying to figure out how to use the CryptoJS library for AES but the documentation is somewhat scarce.
I've followed their example but I can't seem to decode something that I encoded in PyCrypto
I've formatted as follows:
key = '0f3f0fe38eb5f216cb4ef0649f81d761'
ciphertext = 'Y+gwBI6R37Ko1lQmwZ57gg==FqUSqQ=='
The ciphertext has two components
iv: Y+gwBI6R37Ko1lQmwZ57gg==
encoded message: FqUSqQ==
I tried running the code below but it didn't work. It logs "" in the console. It should be resolving to 'Test'
var decrypted =CryptoJS.AES.decrypt(ciphertext, key);
console.log( decrypted.toString(CryptoJS.enc.Utf8) );
Any pointers would great. Thanks
I ran into this problem as well and unfortunately it was very tricky to get
pycrypto
to talk tocrypto-js
. Here are the combination that worked for me:MODE_CFB
withsegment_size=128
when encrypting in PythonCryptoJS.lib.CipherParams.create({ ... })
Take a look at the code that works for me (Python 2.7.x):
https://gist.github.com/marcoslin/8026990