AES_ DECRYPT
On this page
Decrypts the given ciphertext using the AES (Advanced Encryption Standard) algorithm, with a 128-bit key .
Syntax
AES_DECRYPT(ciphertext, key)
Arguments
-
ciphertext: the binary data to decrypt.
-
key: the text or binary key to use for decryption.
Return Type
The plain text, or NULL if the key does not decrypt the ciphertext .
Remarks
-
Encryption Algorithm: AES
-
Key Size: 128 bit
-
Operation Mode:
-
ECB: Electronic Code Book mode
-
-
IV (initialization vector): Not used,
Examples
Note: the UNHEX function is used in this example to make it easier to handle binary data.
SELECT AES_DECRYPT(unhex('C958FF3BC0134ADE4A8F952338C1FAEC'), 'ohai');+----------------------------------------------------------------+| AES_DECRYPT(unhex('C958FF3BC0134ADE4A8F952338C1FAEC'), 'ohai') |+----------------------------------------------------------------+| secret message |+----------------------------------------------------------------+SELECT AES_DECRYPT(unhex('C958FF3BC0134ADE4A8F952338C1FAEC'), 'bad key');+-------------------------------------------------------------------+| AES_DECRYPT(unhex('C958FF3BC0134ADE4A8F952338C1FAEC'), 'bad key') |+-------------------------------------------------------------------+| NULL |+-------------------------------------------------------------------+
Related Topics
Last modified: February 27, 2023