Name

DES_DECRYPT( )

Synopsis

DES_DECRYPT(string, [key])

This function decrypts text that was encrypted using the triple DES algorithm with a 128-bit key length. It returns NULL if an error occurs. This function will work only if MySQL has been configured for secure sockets layer (SSL) support. It reverses the DES_ENCRYPT( ) function. This function is available as of Version 4.0.1 of MySQL.

SELECT DES_DECRYPT(credit_card_nbr, 0)
   FROM orders
   WHERE order_nbr = '8347';

In this example, the value for the credit_card_nbr column is decrypted using the first key string in the key file. See the description of DES_ENCRYPT( ) for more information on key files.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.