One Two Three
One Two Three

Reputation: 23517

MySQL aes_encrypt padding scheme?

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

Upvotes: 4

Views: 3170

Answers (4)

Dennis Bunskoek
Dennis Bunskoek

Reputation: 461

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.

Upvotes: 1

rossum
rossum

Reputation: 15693

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.

Upvotes: 1

Eric Petroelje
Eric Petroelje

Reputation: 60528

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

Upvotes: 5

Related Questions