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

CRYPTPASS=

 

String The encryption key. BASIS recommends a password of at least 20 characters when using AES-128 and at least 40 characters when using AES-256.
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

CHARSET=

String

In BBj 16.00 and higher, specifies the character set encoding of the password string.

Example

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