SQL — ENCRYPT Function

Syntax

ENCRYPT (string1,string2)

Description

In BBj 4.0 and higher, the ENCRYPT() function, and counterpart DECRYPT() function, supports encrypted fields. In the syntax, string1 is the string to encrypt, and string2 is the mode line for encryption as described in the ENCRYPT verb documentation. The return value is the binary encrypted string as produced by the ENCRYPT verb.

Mode

Value

Description

CRYPTALG=

AES-128

AES-256

Uses AES-128 bit encryption, which is also the default.

In BBj 6.0 and higher, and PRO/5 6.0 and higher, uses AES-256 bit encryption.

Example

Insert into SecureTable (A,B) Values ('0001',ENCRYPT('a string','CRYPTPASS=abcde'))