{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":41736,"path":"platform-security/platform-encryption/flowkmfencrypter-api.md","title":"FlowKMFEncrypter API","bundle":null,"doc_type":null,"release":"australia","body":"\n# FlowKMFEncrypter API\n\nThe FlowKMFEncrypter API provides secure encryption and decryption for ServiceNow Flow Actions, using the Key Management Framework \\(KMF\\) crypto operations.\n\nFlowKMFEncrypter 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.\n\n**Note:** FlowKMFEncrypter works only in Flow Engine use cases. It does not work in script-layer applications.\n\n## How it works\n\nThe 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.\n\n## FlowKMFEncrypter\\(\\) - constructor\n\nCreates a new instance of the FlowKMFEncrypter class. The constructor initializes the encrypter with the necessary KMF crypto operations configuration.\n\n-   **Syntax**\n\n    ```\n    new FlowKMFEncrypter()\n    ```\n\n-   **Parameters**\n\n    None\n\n\n## encrypt\\(input\\)\n\nEncrypts plaintext data using AES symmetric encryption.\n\n-   **Syntax**\n\n    ```\n    encrypt(input: String): String\n    ```\n\n-   **Parameters**\n\n    |Name|Type|Description|\n    |----|----|-----------|\n    |input|String|The plaintext string to encrypt.|\n\n-   **Returns**\n\n    |Type|Description|\n    |----|-----------|\n    |String|An encrypted string in KMF-compatible format that can be securely stored and later decrypted.|\n\n\n```\nvar encrypter = new FlowKMFEncrypter();\nvar plainString = \"mySecurePassword123\";\nvar encryptedString = encrypter.encrypt(plainString);\n```\n\n## decrypt\\(input\\)\n\nDecrypts encrypted data back to plaintext using AES symmetric decryption.\n\n-   **Syntax**\n\n    ```\n    decrypt(input: String): String\n    ```\n\n-   **Parameters**\n\n    |Name|Type|Description|\n    |----|----|-----------|\n    |input|String|The encrypted string in KMF-compatible format to decrypt.|\n\n-   **Returns**\n\n    |Type|Description|\n    |----|-----------|\n    |String|The decrypted plaintext string.|\n\n\n```\nvar encrypter = new FlowKMFEncrypter();\nvar encryptedString = \"<encrypted value>\";\nvar decryptedString = encrypter.decrypt(encryptedString);\n```\n\n-   **[FlowKMFEncrypter in a Flow Action](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-security/platform-encryption/allow-flowkmfencrypter-restricted-caller-access.md)**  \nResolve 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.\n\n**Parent Topic:**[Key Management Framework](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/platform-security/encryption.md)\n\n"}}