why wasn't stuff auto-paded?

2 views
Skip to first unread message

deostroll

unread,
Jul 5, 2025, 11:21:26 PMJul 5
to PyCryptodome
Hi,

Below is simple code:

=== START

from Crypto.Cipher import AES
import os
import base64

key = 'This is a key123'
print('key length =', len(key))
iv = 'This is an IV456'
print('iv length =', len(iv))
message = "The answer is no, but greater than 16 charaters"
print('message length =', len(message))

=== END

This obviously errored saying ValueError: Data must be padded to 16 byte boundary in CBC mode

So why was this api not doing the padding? Or is it that padding is a subjective topic dependent on business logic? Are there apis that do autopad?

- deostroll


Reply all
Reply to author
Forward
0 new messages