GlideEncrypter - Global

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

The GlideEncrypter class is used in server scripts in the global scope. The GlideEncrypter class has two constructors:
  • GlideEncrypter()
  • GlideEncrypter(String key)

GlideEncrypter - encrypt(String clearString)

Encrypts a clear string using the Triple DES algorithm.

Table 1. Parameters
Name Type Description
clearString String String to be encrypted.
Table 2. Returns
Type Description
String Encrypted string.
var encr = new GlideEncrypter(); 
var clearString = 'abcdefg'; 
var encrString = encr.encrypt(clearString); 
gs.print("Encrypted string = " + encrString); 
Output:
Encrypted string = 3wjpvKtUIi4=

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.
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 - GlideEncrypter()

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

Table 5. Parameters
Name Type Description
None
var encr = new GlideEncrypter(); 

GlideEncrypter - GlideEncrypter(String key)

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

Table 6. Parameters
Name Type Description
key String Your encryption key must be exactly 24 characters. A key longer than 24 characters will be truncated.
var encr = new GlideEncrypter(myKey);