Overview
This node performs DES (Data Encryption Standard) encryption and decryption on input text data. It supports multiple cipher modes and padding schemes, allowing users to customize the cryptographic process according to their security requirements.
Common scenarios for this node include:
- Encrypting sensitive information before storing or transmitting it.
- Decrypting previously encrypted data to retrieve original content.
- Integrating legacy systems that use DES encryption.
- Testing and validating cryptographic workflows in automation pipelines.
For example, a user might encrypt a password or API key using DES with CBC mode and PKCS7 padding, then store the encrypted string securely. Later, the same node can decrypt the stored string back to plaintext when needed.
Properties
| Name | Meaning |
|---|---|
| Mode | The DES cipher mode to use. Options: CBC, CFB, CTR, ECB, OFB |
| Padding | The padding scheme applied during encryption/decryption. Options: AnsiX923, Iso10126, Iso97971, NoPadding, Pkcs7, ZeroPadding |
| Encoding | The output/input encoding format. Options: Base64, Hex |
| Type | The type of input data. Currently only "String" is supported |
| Text | The actual text string to encrypt or decrypt |
Output
The node outputs JSON objects containing either an encrypted or decrypted field depending on the operation:
For Encrypt operation:
{ "encrypted": "<encrypted_string>" }where
<encrypted_string>is the DES-encrypted text encoded in the selected encoding (Base64 or Hex).For Decrypt operation:
{ "decrypted": "<decrypted_string>" }where
<decrypted_string>is the original plaintext after DES decryption.
No binary data output is produced by this node; all data is handled as strings.
Dependencies
- Requires an external cryptographic library compatible with DES (in this case,
crypto-js). - Needs a valid DES key credential configured in n8n, which provides the encryption/decryption key.
- No additional environment variables are required beyond the API key credential.
Troubleshooting
- Invalid Key Length: The DES key must be at least 16 characters long since the code slices the first 32 characters into two parts for key and IV. Ensure your key meets this requirement.
- Incorrect Mode or Padding: Using incompatible mode and padding combinations may cause errors or incorrect results. Verify that the chosen mode and padding are supported and appropriate for your data.
- Malformed Input Text: If the input text is not properly encoded (e.g., invalid Base64 or Hex), decryption will fail with an error.
- Error Messages: Errors thrown typically contain messages from the underlying crypto library. If the node fails, check the error message for clues such as "Malformed UTF-8 data" or "Invalid padding".
- Continue On Fail: The node supports continuing execution on failure per item, allowing partial processing without stopping the entire workflow.
Links and References
- CryptoJS GitHub Repository – The cryptographic library used for DES operations.
- DES Wikipedia Article – Background on the DES algorithm.
- n8n Documentation – General guidance on creating and using custom nodes.