AES_ENCRYPT()

Overview

Encrypts data using the AES algorithm with the given key.

USAGE

AES_ENCRYPT(text, key_string)

Argument Name

Description

text

The string to encrypt

key_string

The encryption key to use

DETAILS

AES_ENCRYPT() is an encryption function that encrypts a string using the Advanced Encryption Standard (AES) and returns a binary string.

A NULL is returned if any of the arguments is NULL.

SYNONYMS

SCHEMA

PARAMETERS

SKYSQL

PRIVILEGES

EXAMPLES

SET @result = HEX(AES_ENCRYPT(
       'This is a test string to encrypt',
       'This is the AES key to use'));
SELECT SUBSTRING(@result, 1, 32) AS Hex_Substring;
+----------------------------------+
| Hex_Substring                    |
+----------------------------------+
| C3448D2B75B4C4F32221F78B7098FCBE |
+----------------------------------+
SET @key_str = SHA2('passphrase', 512);

SELECT HEX(AES_ENCRYPT('hello', @key_str))
          AS Hex_String;
+----------------------------------+
| Hex_String                       |
+----------------------------------+
| B8656AA940B6D6ABAD5DA4891E746ED9 |
+----------------------------------+

ERROR HANDLING

FEATURE INTERACTION

RESPONSES

DIAGNOSIS

ISO 9075:2016

CHANGE HISTORY

Release Series

History

23.09

  • Present starting in MariaDB Xpand 23.09.1.

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

EXTERNAL REFERENCES