I'm trying to figure out how padding works by seeing what happens when I try to encrypt a 16 byte file with AES-128-CBC. My understanding was if I encrypt a file of size, say, 28, then there would automatically be 4 bytes of padding to make it 32. But when I encrypted my 16-byte file, the size ended up being 48 bytes. I did research and learned that a single padding block is automatically added to direct multiples in order to distinguish the padding from the plaintext, but if that's so, then why is it 48 bytes and not 32 as well (16 plaintext + 16 padding)?
Asked
Active
Viewed 2,360 times