suculent / thinx-aes-lib

AES wrapper for ESP8266/ESP32/Arduino/nRF5x
Other
113 stars 39 forks source link

simple example doesnt work on uno #46

Closed vonkonow closed 3 years ago

vonkonow commented 3 years ago

Hi I cant get "simple" example to work correctly on uno (No rush, "medium" example works - I will use that instead)

This is the dump from serial terminal: readBuffer length: 18 Calling encrypt (string)... Encrypted length = 44 Encrypted. Decrypting... 44 Calling decrypt...; Decrypted bytes: 44 Decrypted cleartext of length: 44 Decrypted cleartext:

⸮C⸮⸮䡯:=⸮⸮⸮.⸮HC⸮⸮J⸮⸮t⸮} ⸮i⸮

Decryption test failed.

vonkonow commented 3 years ago

Hi after spending hours with both simple and medium I couldnt get either to output the same result as the test vectors in: https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Algorithm-Validation-Program/documents/aes/AESAVS.pdf I eventually used a simpler library that worked on the first try: https://github.com/DavyLandman/AESLib I suspect that i have missunderstood the implementation...

suculent commented 3 years ago

OK, so don't know why/how exactly but the encrypt function did accidentally include base64 conversion. It should not be there so I've removed it. After that change, the simple example forks as expected again.