encrypt_fpe()
Description
Given a cleartext string in Unicode or Latin characters and a profile name, returns its encrypted equivalent.
function encrypt_fpe (inputString varchar(8192) CHARACTER SET UNICODE, inputKeyname varchar(256)) returns varchar(8192) CHARACTER SET UNICODE
To accept Latin characters as input, the encrypt_fpe()
call must refer to a profile that uses a predefined Latin character set.
If there are characters in the plaintext input that are not specified in the character set, they are left in their current positions unchanged in the tokenized output. If the plaintext input is less than 2 characters (not counting characters that are not specified in the character set), the output of the UDF is the same as the plaintext input. FPE can tokenize only strings with 2 or more characters.
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 customer’s first and last name. It is assumed that a profile has been set up in profiles.conf
with the name tokenize_name
and the encryption method fpe
.
# select thales.encrypt_fpe('John Doe','tokenize_name');
# select thales.encrypt_fpe('John Doe','tokenize_name');
*** Query completed. One row found. One column returned.
*** Total elapsed time was 2 seconds.
thales.encrypt_fpe('John Doe','tokenize_name')
-------------------------------------------------------------------
OHBU cCj