encrypt_cbc()
Description
Given a cleartext string in Unicode format and a profile name, returns its encrypted equivalent.
function encrypt_cbc (inputString varchar(8192) CHARACTER SET UNICODE, inputKeyname varchar(256)) returns varbyte(16400)
The input string must adhere to BTEQ requirements, such as escaping special characters. For example, if the input string contains an apostrophe, use a double apostrophe: 'It''s a beautiful day'
.
Example
The following example encrypts a credit card number. This assumes that a profile has been set up in profiles.conf
with the name ccnum
and the encryption method aes_cbc_pad
.
# select thales.encrypt_cbc('1234-9876-5678-6543', 'ccnum');
# select thales.encrypt_cbc('1234-9876-5678-6543', 'ccnum';
System Response
*** Query completed. One row found. One column returned.
*** Total elapsed time was 2 seconds.
thales.encrypt_cbc('1234-9876-5678-6543', 'ccnum'
-------------------------------------------------------------------
BE08C791A97E8FAC725DA39AFC071BD30A32C70C514E00B8D6D420501EF8B9D60F06537CE93