Skip to content
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

Bug: AES padding scheme ignored when decrypting #33

Open
jimukgb opened this issue Apr 1, 2024 · 0 comments
Open

Bug: AES padding scheme ignored when decrypting #33

jimukgb opened this issue Apr 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jimukgb
Copy link

jimukgb commented Apr 1, 2024

Describe the current behavior

AES decryption function takes the last byte of the plain text and if it is between 0x00 and 0x3F, it removes the corresponding number of bytes from the end of the plaintext (assumes it is the padding) otherwise is returns an error.

Describe the expected behavior

CBC and ECB modes use a padding scheme and the padding bytes can only take values between 0x01 and 0x10 (AES block size is 16 bytes). Further, the padding byte is repeated from the end of the message until the end of the block (or for one full block if the message length is divisible by 16 i.e. 0x10101010101010101010101010101010). For example 0xFFFFFFFFFFFFFFFFFFFFFF0505050505 is valid padding but 0xFFFFFFFFFFFFFFFFFFFFFF0000000005 is not, however, currently both are accepted as valid.

@jimukgb jimukgb added the bug Something isn't working label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant