The GlideEncrypter API provides methods to encrypt and decrypt strings using the Triple DES algorithm.

Note: The GlideEncrypter API uses the three-key Triple DES encryption standard which NIST 800-131A Rev 2 has recommended against using to encrypt data after 2023. Please take a moment to review the information below.
  • Starting with the Xanadu family release, the GlideEncrypter API is not recommended for use, as this API is deprecated according to NIST guidelines. This API will be officially removed with the Zurich release.
  • Review the following Knowledge Base article for migration guidance to the applicable replacement solution based on your current use case: Alternatives to deprecated GlideEncrypter APIs.
If the GlideEncrypter API is no longer used on your instance, you may deprecate 3DES. For details, see Prepare your instance for GlideEncrypter deprecation.
You can use this API in server scripts in the global scope. The GlideEncrypter class has two constructors:
  • GlideEncrypter()
  • GlideEncrypter(String key)

GlideEncrypter - GlideEncrypter()

Creates an instance of the GlideEncrypter class using a default (static) encryption key.

Table 1. Parameters
Name Type Description
None

Example

var encr = new GlideEncrypter(); 

GlideEncrypter - GlideEncrypter(String key)

Creates an instance of the GlideEncrypter class using a given encryption key.

Table 2. Parameters
Name Type Description
key String Your encryption key must be exactly 24 characters. A key longer than 24 characters will be truncated.

Example

var encr = new GlideEncrypter(myKey); 

GlideEncrypter - decrypt(String encryptedString)

Decrypts a clear string using the Triple DES algorithm.

Table 3. Parameters
Name Type Description
encryptedString String String to be decrypted.
Table 4. Returns
Type Description
String Clear text string.

Example

var encr = new GlideEncrypter(); 
var clearString = 'abcdefg'; 
var encrString = encr.encrypt(clearString);
var decrString = encr.decrypt(encrString);  
gs.print("Decrypted string = " + decrString);
Output:
Decrypted string = abcdefg

GlideEncrypter - encrypt(String clearString)

Encrypts a clear string using the Triple DES algorithm.

Table 5. Parameters
Name Type Description
clearString String String to be encrypted.
Table 6. Returns
Type Description
String Encrypted string.

Example

var encr = new GlideEncrypter(); 
var clearString = 'abcdefg'; 
var encrString = encr.encrypt(clearString); 
gs.print("Encrypted string = " + encrString); 
Output:
Encrypted string = 3wjpvKtUIi4=