Skip to main content
Version: V1.0.0

DES_DECRYPT

Declaration

DES_DECRYPT(crypt_str[,key_str])

Description

This function is used to decrypt a string encrypted by the DES_ENCRYPT() function. If an error occurs, it returns NULL. This function is only effective when seekdb is configured to support SSL.

The key_str parameter is used to pass the key for decrypting the message. If the key_str parameter is not specified, the DES_DECRYPT() function checks the first byte of the encrypted string to determine the DES key number used to encrypt the original string, then reads the key from the DES key file to decrypt the string. Therefore, the user must have the SUPER privilege.

If the crypt_str parameter is not an encrypted string, it is returned directly.

Examples

SELECT DES_DECRYPT(DES_ENCRYPT('secret','cry'), 'cry');
+-------------------------------------------------+
| DES_DECRYPT(DES_ENCRYPT('secret','cry'), 'cry') |
+-------------------------------------------------+
| secret |
+-------------------------------------------------+
1 row in set (0.001 sec)