Comments - AES_ENCRYPT

1 year, 9 months ago Martijn Zijlstra

The used cipher mode is ECB. I have tested this with PHP, see code below.

MariaDB :

SELECT TO_BASE64(AES_ENCRYPT('encrypt me', 'C3og!IBCTQ@x10zi'))

-> tCF4vMMzCcp+Sko1r1aQ+Q==

PHP :

echo openssl_encrypt('encrypt me', 'aes-128-ecb', 'C3og!IBCTQ@x10zi');

-> tCF4vMMzCcp+Sko1r1aQ+Q==

Make sure the passphrase (key_str) in MariaDB does not exceed 16 characters! MariaDB won't use any longer, but PHP will. PHP max passphrase length is 256 characters.

So using more than 16 characters will result in MariaDB given diffirent results than PHP.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.