Overview
This node provides GPG (GNU Privacy Guard) encryption and decryption capabilities within n8n workflows. It supports two main operations: encrypting and decrypting data, which can be either text strings or files in binary form.
Typical use cases include:
- Encrypting sensitive text data before sending it to external systems.
- Decrypting received encrypted files or messages for further processing.
- Securely handling confidential information within automated workflows.
For example, you might use this node to encrypt a password string before storing it or to decrypt an encrypted file attachment received via email.
Properties
Name | Meaning |
---|---|
Type | Choose the input data type: File (binary data) or String (text data). |
Text | The plaintext string to encrypt or the encrypted string to decrypt (shown only if Type is "String"). |
Binary Property | The name of the binary property containing the file data to encrypt or decrypt (shown only if Type is "File"). Default is "data" . |
Output Property | The name of the binary property where the output file will be stored after encryption/decryption (only for File type). Defaults to "encrypted" for encryption and "decrypted" for decryption if not set. |
Add Additional Properties | Boolean flag to add extra custom properties to the output JSON object (only for String type). |
Additional Properties | A JSON object with any additional data to include in the output when Add Additional Properties is enabled (only for String type). |
Output
The node outputs JSON data representing the result of the operation:
For String type:
- When encrypting, the output JSON contains an
encrypted
field with the encrypted string. - When decrypting, the output JSON contains a
decrypted
field with the decrypted string. - If additional properties are added, they appear alongside the encrypted/decrypted data.
- When encrypting, the output JSON contains an
For File type:
- The output includes a binary property (name configurable) containing the encrypted or decrypted file data.
- Encrypted files have
.gpg
extension and MIME typeapplication/pgp-encrypted
. - Decrypted files retain the original filename and appropriate binary data.
The node returns execution metadata compatible with n8n's workflow system, allowing seamless chaining with other nodes.
Dependencies
- Requires an API key credential that provides access to the GPG private/public keys and passphrase.
- Uses the
openpgp
library for cryptographic operations. - No external services beyond the provided credentials are needed.
Troubleshooting
Common issues:
- Incorrect or missing GPG keys or passphrases in credentials will cause failures during encryption/decryption.
- Providing invalid or corrupted encrypted data will result in decryption errors.
- Specifying a non-existent binary property name will cause the node to fail asserting binary data.
Error messages:
- Errors related to key reading or decryption usually indicate invalid keys or wrong passphrase; verify your credentials.
- "No binary data found" errors mean the specified binary property does not exist on the input item.
- Encryption errors may occur if the public key is malformed or missing.
To handle errors gracefully, enable the node’s "Continue On Fail" option to allow workflow continuation despite individual item failures.