Encryption Functions
Encryption functions encrypt data stored in tables. The encryption functions include AES_ENCRYPT and AES_DECRYPT. For more information, see the Security Guide.
AES_ENCRYPT
AES_ENCRYPT(column_name,'encryption_passphrase')
Operand type: Any character type. The function accepts only VARBYTE, so compatible types are automatically converted to VARBYTE. If the value being encrypted is integer, float or another data type incompatible with VARBYTE, it is necessary to explicitly cast the data.
Result type: VARBYTE
Encrypts the values to be inserted or updated in a table.
The data can be read only by using the AES_DECRYPT function, supplying the encryption passphrase.
Example:
INSERT INTO socsec2 SELECT
fname, lname,
AES_ENCRYPT(socsec,'user function encryption')
FROM socsec1
AES_DECRYPT
AES_DECRYPT(column_name,'encryption_passphrase')
Operand type: VARBYTE
Result type: VARBYTE
Decrypts data (allows encrypted data to be read in plain text) by supplying the encryption passphrase.
Example:
SELECT columnname, columnname,
AES_DECRYPT(columnname,'encryption_passphrase') AS columnname
FROM table2