GlideEncrypter - Global (deprecated)

  • Release version: Yokohama
  • Updated January 30, 2025
  • 1 minute to read
  • 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. With the Zurich release, the GlideEncrypter API will be upgraded to automatically use Key Management Framework.
    • New instance installations and re-installations using the GlideEncrypter API in the ServiceNow AI Platform will not be permitted in the Zurich release planned for September 2025. Use the Instance Scan to identify where GlideEncrypter is used on your instance. Find this tool on your instance by navigating to Instance Scan > Suites > GlideEncrypter.
    • 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
    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.
    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.
    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.
    var encr = new GlideEncrypter(); 
    var clearString = 'abcdefg'; 
    var encrString = encr.encrypt(clearString); 
    gs.print("Encrypted string = " + encrString); 
    
    Output:
    Encrypted string = 3wjpvKtUIi4=