Syntax
ENHANCED_AES_DECRYPT(cipher_text[, iv])
Purpose
This function is primarily used for AES decryption, which can be enabled by using the
tde_methodparameter. For more information, see tde_method.The required privilege for this function is
DECRYPT.cipher_textis the ciphertext to be decrypted using AES.[, iv]is an optional parameter that represents the initialization vector.The input parameter
cipher_textfor the decryption functionENHANCED_AES_DECRYPTmust be the result generated by theENHANCED_AES_ENCRYPTfunction; otherwise, it will trigger the 4334OB_ERR_AES_DECRYPTerror.
Examples
The SELECT statement uses the decryption function to return plaintext.
-- Return plaintext
SELECT ENHANCED_AES_DECRYPT(cipher_col) FROM tbl;
Direct comparison between ciphertext and its corresponding plaintext is not supported. You need to decrypt the ciphertext or encrypt the plaintext before performing the comparison.
-- After decrypting cipher_col, it is expected to match the corresponding plaintext data '12345'. However, indexes cannot be utilized.
SELECT ... FROM tbl WHERE ENHANCED_AES_DECRYPT(cipher_col) = '12345';