mysql shows error: Error in query (1582): Incorrect parameter count in the call to native function 'AES_DECRYPT' I'm using mariaDB I have tried diffe.net options but all ends up at same place
SET @key_str = '3C5QYgFQr9AARjMyLNNQ3fL8QauXLTz0';
SET @iv = 'kaNUE3JAIVB9Em9v';
SET @ciphertext = AES_ENCRYPT('Hello', @key_str, @iv);
SELECT AES_DECRYPT(@ciphertext, @key_str, @iv);```
My requirement is to use aes-256-cbc encryption using MariaDB
If you are using MariaDB, you should read the MariaDB documentation, not the MySQL documentation.
https://mariadb.com/kb/en/aes_encrypt/ shows AES_ENCRYPT()
only has two arguments. This matches the implementation of that function as of MySQL 5.5, when MariaDB forked from MySQL in 2010. Since then, MySQL 5.7 and later changed the function to accept more arguments.
In general, you shouldn't think of MariaDB and MySQL as variants of the same product anymore. They have both changed significantly since they forked, and there are many cases where they are no longer compatible.
Here's a feature request for MariaDB to support the IV and block encryption mode: https://jira.mariadb.org/browse/MDEV-9069
As of 2022-12-12 (version 10.10 is current as I write this), the feature is not yet implemented. So there is no support currently in MariaDB for CBC or other encryption modes. It still functions as it did in MySQL 5.5.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.