-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encrypted Hex differs from Node #47
Comments
Which mode of operation are you using? Is there any padding being done by the other library? Can you provide an example for both the other library and
If you don't know some of the above, I may be able to figure it out from the others. Thanks. :) |
ricmoo, Please see below the information:
The encrypted hex is: 0bbcfccb51ad9937c7ae31aa349a98f297dcef4e6b7434898d72f01265011542 On Node I am using aes128 with the default settings, including auto padding (pkcs7). Thanks a lot for your help on this. Regards, |
Is there maybe something going on with your Buffer class in the browser? I get: var key = "4847afd2c068b1644d47709892bde97d"
var iv = "a005f0cb74cb344427e545894bdec41a"
var aesCfb2 = new aesjs.ModeOfOperation.cfb(aesjs.utils.hex.toBytes(key), aesjs.utils.hex.toBytes(iv));
var encryptedBytes2 = aesCfb2.encrypt(aesjs.padding.pkcs7.pad(aesjs.utils.utf8.toBytes("this is a test")));
console.log(aesjs.utils.hex.fromBytes(encryptedBytes2));
"92341e8fd232ccffca3cff8151da626f" Is that what you get in node? |
@ricmoo
I get the exception, why?
|
@aborigene has this been resolved and the issue be closed? |
This issue should be closed due to lack of response... |
Is this still a problem? |
I am using the library on a client connecting to a node backend. The problem is that I am receiving an error Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt.
I have checked and the same data input with same iv and same key, generates different encrytped hex on both sides. What catches my attention is that in one of the cases the hex usin AESJs on the client is much smaller than the one from Node.
Encrypting and decrypting on Node (isolated) and on the client run fine, the problem is when encrypt on the client and send to Node.
Is there any mode I should change that I am not aware of? I have tried all the IV initiaded modes with no luck. Below some examples:
Input data1: 'este é um teste'
Encrypted Hex1 Node: 0b247a5b635d84639cc02722bd8257f256bc2fd7b12fcacdc8d082e9f6951bf7
Ecnrypted Hex1 Client: 554fb689bca935a2a92278739c23d353Comments
Input data2: '{"CPF":"29278804843","action":"verificarCPF","nonce":"6f1ae96b7ba43d4f1985fa37d"}'
Encrypted Hex2 Node: c575af80bde78b8040aa5b4d37ff0204eba68fcfbe004453e9b41e964303ee2fac43ff50bdd2e62a893b34fbeef3731c573672934640383818eefc77e1f052f7eec9795ee47465e249159f529e14599ff85f296c4e67fc3bcbde89af969b6d52
Encrypted Hex2 Client: e340c06df883d4dacf9fe1a814dabee8ab5eaf39728ad2544348f60aa5909f78a0fdb3d8f3c17247ed37bed559b702788d6a6ed5029c768179415a918a771b49833047def73e97e5453fcd931241104b7e697668f4c66f359ee8b48ff418f1ff
Regards,
The text was updated successfully, but these errors were encountered: