问题
Does anyone know what padding scheme mysql uses for their aes_encrypt?
I've done a lot of googling, and all I found was "byte padding". But that's too general!
Thanks
回答1:
The data padding is done per RFC3369/PKCS#5. Keys are zero padded. Unfortunately, neither of these are documented, but I got the information from this bug report:
http://bugs.mysql.com/bug.php?id=16713
回答2:
Here's a good explanation with code that demonstrates how the padding works.
回答3:
If you don't know what padding is being used, then decrypt with "NoPadding". Have a look at what has been added to the end of the last block, and that will tell you what padding style is being used.
回答4:
This answer put me on the right track:
https://stackoverflow.com/a/19692724
So it really is PKCS7, as Marcus Adams noted as well.
Hope this helps someone.
来源:https://stackoverflow.com/questions/10417250/mysql-aes-encrypt-padding-scheme