suculent / thinx-aes-lib

AES wrapper for ESP8266/ESP32/Arduino/nRF5x
Other
117 stars 38 forks source link

Decryption error in "medium example" #37

Closed mrdc closed 3 years ago

mrdc commented 4 years ago

Hello,

I'm having this issue with aes-lib (2.1.9) when I enter 3 characters: fff, aaa, bbb etc:

INPUT:fff
encrypted = MO5BFeJhLongSfatmr7H8w==
Ciphertext: MO5BFeJhLongSfatmr7H8w==
Cleartext: fff���������
FAILURE

The same for 6(9...etc) characters:

INPUT:bbbbbb
encrypted = HGiY8jseEhOy3NqNhTxmww==
Ciphertext: HGiY8jseEhOy3NqNhTxmww==
Cleartext: bbbbbb������
FAILURE

Padding issue?

suculent commented 3 years ago

What padding do you use? I've recently updated examples to set padding always explicitly.

suculent commented 3 years ago

Please attach your key/iv otherwise the padding is not possible to infer from your question.

suculent commented 3 years ago

Thanks for your report. This was indeed error in versions <2.2.2, where the decrypted length value was incorrect (based on decrypted length before base64 decoding).