If I use PKCS7 padding in RijndaelManaged with 16 bytes of data then I get 32 bytes of data output. It appears that for PKCS7 when the data size matches the block size it adds a whole extra block of data.
If I use Zeros padding for 16 bytes of data I get out 16 bytes of data. So for Zeros padding if the data matches the block size then it doesn’t pad.
I have searched through the documentation and it says nothing about this difference in padding behavior.
Can someone please point me to some kind of documentation which specifies what the padding behavior should be for the different padding modes when the data size matches the block size.
I came across this article which offers an explanation that seems to jibe with some other articles I found during my searching. Here’s the basic reason: