MySQL aes_encrypt padding scheme?

社会主义新天地 提交于 2019-12-10 18:25:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!