Declaration
ENHANCED_AES_DECRYPT(cipher_text[, iv])
Description
This function is primarily used for column encryption, which is controlled by the
tde_methodparameter. For more information, see tde_method.The function requires the
DECRYPTprivilege.cipher_text: The ciphertext to be decrypted by AES.[, iv]is an optional parameter that specifies the initialization vector.The input parameter
cipher_textof the decryption functionENHANCED_AES_DECRYPTmust be a result generated by theENHANCED_AES_DECRYPTfunction. Otherwise, a 4334OB_ERR_AES_DECRYPTerror is raised.
Examples
The SELECT statement uses the decryption function to return the plaintext column.
-- Return Plaintext
SELECT ENHANCED_AES_DECRYPT(cipher_col) FROM tbl;
The ciphertext is directly compared with its corresponding plaintext, which is expected to return false. The ciphertext needs to be decrypted, or the plaintext needs to be encrypted, before comparison.
-- After decrypting cipher_col, the expected plaintext data '12345' cannot be matched. The index cannot be used.
SELECT ... FROM tbl WHERE ENHANCED_AES_DECRYPT(cipher_col) = '12345';