bricke / Qt-AES

Native Qt AES encryption class
The Unlicense
501 stars 187 forks source link

Regarding the problem that the padding is not removed after decryption #44

Closed boboliliy closed 2 years ago

boboliliy commented 2 years ago

Hi, after the string is encrypted, it is decrypted. The decrypted string is filled with other characters, such as: Before encryption:NAAAACA9ARUMGMCJ2EPLCHKTF After decryption:NAAAACA9ARUMGMCJ2EPLCHKTF\x80\x00\x00\x00\x00\x00\x00 I checked the source code, should I call removePadding function before QAESEncryption::decode returns to solve the problem?

bricke commented 2 years ago

The padding needs to be removed after the decryption is done.

bricke commented 2 years ago

Take a look at this test function where the removePadding is used: https://github.com/bricke/Qt-AES/blob/845e3b4d3d3873843ca26dc365232aa1aa8ea2a8/unit_test/aestest.cpp#L204