GlideEncrypter - Global (deprecated)
The GlideEncrypter API provides methods to encrypt and decrypt strings using the Key Management Framework (KMF).
Important:
The GlideEncrypter API no longer supports Triple Data Encryption Standard (3DES) due to NIST guidelines (see NIST 800-131A Rev 2). As a result, the following changes were implemented in the Zurich release:
- For existing instances that upgrade to the Zurich release, the
GlideEncrypterAPI is available for use but has been updated to automatically use the Key Management Framework (KMF) algorithm. - For all new instances created starting with the Zurich release, the
GlideEncrypterAPI is no longer supported. Directly use the Key Management Framework instead for all cryptography operations.
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 Key Management Framework (KMF) cryptographic module.
| Name | Type | Description |
|---|---|---|
| None |
var encr = new GlideEncrypter();
GlideEncrypter - GlideEncrypter(String key)
Creates an instance of the GlideEncrypter class using a given encryption key.
| Name | Type | Description |
|---|---|---|
| key | String | Customer key to be used for encrypting or decrypting using Triple DES algorithm. Encryption key must be exactly 24 characters. A key longer than 24 characters will be truncated. |
var encr = new GlideEncrypter(myKey);
GlideEncrypter - decrypt(String encryptedString)
Decrypts a clear string using the KMF-based Advanced Encryption Standard (AES) algorithm.
| Name | Type | Description |
|---|---|---|
| encryptedString | String | String to be decrypted. |
| 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 = abcdefgGlideEncrypter - encrypt(String clearString)
Encrypts a clear string using the Key Management Framework (KMF) algorithm.
| Name | Type | Description |
|---|---|---|
| clearString | String | String to be encrypted. |
| Type | Description |
|---|---|
| String | Encrypted string. |
The following example uses the GlideEncrypter() constructor to encrypt a given string:
var encr = new GlideEncrypter();
var clearString = 'abcdefg';
var encrString = encr.encrypt(clearString);
gs.print("Encrypted string = " + encrString);
Output:
Encrypted string = febaf83bff31221093d7ffffffffff79 1BaXD6acaRjZLPUn_bZiZ-w==2c9-PNa0qouYXyBhJtV6-2E31Rm7mWg=