suculent / thinx-aes-lib

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

AESLib::encrypt uses incorrect size parameter when encrypting long texts #8

Closed kavers1 closed 5 years ago

kavers1 commented 5 years ago

When encrypting texts that generate b64encoded strings longer than 16 character the AESLib::encrypt will pad the text to the next paddedLen bytes. The paddedLen parameter is calculated locally but aes.padplaintext assumes side effect from the aes::calc_size_n_pad. (side effects are that size and pad parameter are set by the functioncall)

Would it be a good idea to add a function to calculate the padded length which also generates these side effects ?

int AES::get_padded_len(int p_size){ calc_size_n_pad(p_size); return size; }

suculent commented 5 years ago

Good idea. You’re free to post a PR

kavers1 commented 5 years ago

is solved in merge request #9