decrypt_char()
Description
Given an encrypted string created using encrypt_char(), the key used to encrypt data, and the column size, returns its decrypted cleartext.
function decrypt_char (inputString varbyte(16000), inputKeyname varchar(256), inputCharcolumnsize INTEGER) returns varchar(16384)
Note
decrypt_char() cannot be used to decrypt data that was created using encrypt_string(), encrypt_cbc(), encrypt_fpe(), or encrypt_ff1(). Use the corresponding decrypt_data(), decrypt_cbc(), decrypt_fpe(), or decrypt_ff1() with those UDFs instead.
Example
See the encrypt_char example code to create a table.
BTEQ -- Enter your SQL request or BTEQ command:
select column1, '[' || thales.decrypt_char( thales.encrypt_char(column2, 'KEY-NEW' ,13) ,
'KEY-NEW' ,13) || ']' as enc_dec_col2 from testvar2;
select column1, '[' || thales.decrypt_char( thales.encrypt_char(column2, 'KEY-NEW' ,13) ,
'KEY-NEW' ,13) || ']' as enc_dec_col2 from testvar2;
*** Query completed. 3 rows found. 2 columns returned.
*** Total elapsed time was 1 second.
column1 enc_dec_col2
----------- ----------------------------------------------------
3 [1236974 ]
1 [1234567890123]
2 [rt ]
Note
Column size is maintained and filled with trailing spaces in the output, which would not be possible using encrypt_string/decrypt_data.