Syntax
ENHANCED_AES_DECRYPT(cipher_text[, iv])
Purpose
This function is mainly used to AES decrypt data. The feature is controlled by the
tde_methodparameter. For more information, see tde_method.The required privilege is
DECRYPT.cipher_textis the ciphertext to be AES decrypted.[, iv]is an optional parameter that specifies the initialization vector.The
cipher_textparameter of the decryption functionENHANCED_AES_DECRYPTmust be the result generated by theENHANCED_AES_DECRYPTfunction. Otherwise, the 4334OB_ERR_AES_DECRYPTerror will be returned.
Examples
The SELECT statement uses the decryption function to return the plaintext.
-- Return the plaintext.
SELECT ENHANCED_AES_DECRYPT(cipher_col) FROM tbl;
Direct comparison between ciphertext and plaintext is not supported. You must decrypt the ciphertext or encrypt the plaintext before comparison.
-- Decrypt the cipher_col and expect to match the corresponding plaintext data '12345'. However, the index cannot be used.
SELECT ... FROM tbl WHERE ENHANCED_AES_DECRYPT(cipher_col) = '12345';