Skip to content
Release: Australia · Updated: 2026-06-22 · Official documentation · View source

FlowKMFEncrypter API

The FlowKMFEncrypter API provides secure encryption and decryption for ServiceNow Flow Actions, using the Key Management Framework (KMF) crypto operations.

FlowKMFEncrypter is a ServiceNow Script Include that provides secure encryption and decryption capabilities for Flow Actions using the Key Management Framework (KMF) crypto APIs. This API replaces the deprecated GlideEncrypter and work with Flow Engine while adhering to Module Access Policy (MAP) requirements.

Note: FlowKMFEncrypter works only in Flow Engine use cases. It does not work in script-layer applications.

How it works

The FlowKMFEncrypter API uses the AES algorithm with symmetric key wrapping and unwrapping operations. The Flow Engine Crypto Module supplies the encryption key. This approach is used to securely handle sensitive data, such as credentials and passwords, within Flow Actions.

FlowKMFEncrypter() - constructor

Creates a new instance of the FlowKMFEncrypter class. The constructor initializes the encrypter with the necessary KMF crypto operations configuration.

  • Syntax

    new FlowKMFEncrypter()
    
  • Parameters

    None

encrypt(input)

Encrypts plaintext data using AES symmetric encryption.

  • Syntax

    encrypt(input: String): String
    
  • Parameters

    NameTypeDescription
    inputStringThe plaintext string to encrypt.
  • Returns

    TypeDescription
    StringAn encrypted string in KMF-compatible format that can be securely stored and later decrypted.
var encrypter = new FlowKMFEncrypter();
var plainString = "mySecurePassword123";
var encryptedString = encrypter.encrypt(plainString);

decrypt(input)

Decrypts encrypted data back to plaintext using AES symmetric decryption.

  • Syntax

    decrypt(input: String): String
    
  • Parameters

    NameTypeDescription
    inputStringThe encrypted string in KMF-compatible format to decrypt.
  • Returns

    TypeDescription
    StringThe decrypted plaintext string.
var encrypter = new FlowKMFEncrypter();
var encryptedString = "<encrypted value>";
var decryptedString = encrypter.decrypt(encryptedString);
  • FlowKMFEncrypter in a Flow Action
    Resolve the "undefined is not a function" error that occurs when a Flow Action calls the FlowKMFEncrypter API, by allowing the operation in the Restricted Caller Access Privilege record.

Parent Topic:Key Management Framework