DES icon

DES

Use DES to encrypt or decrypt data

Overview

This node provides encryption and decryption functionality using the DES (Data Encryption Standard) algorithm. It supports multiple cipher modes (CBC, CFB, CTR, ECB, OFB) and various padding schemes, allowing users to securely encode or decode text data. This node is useful in scenarios where legacy symmetric encryption is required, such as decrypting data from older systems or encrypting data for compatibility with systems that use DES.

Practical examples include:

  • Decrypting a Base64-encoded DES-encrypted string received from an external service.
  • Encrypting sensitive information before storing it in a database or sending it over a network.
  • Testing cryptographic workflows involving DES with different modes and paddings.

Properties

Name Meaning
Mode The cipher mode to use for DES operation. Options: CBC, CFB, CTR, ECB, OFB
Padding The padding scheme applied during encryption/decryption. Options: AnsiX923, Iso10126, Iso97971, NoPadding, Pkcs7, ZeroPadding
Encoding The encoding format of the input/output text. Options: Base64, Hex
Type The type of input data. Currently only "String" is supported
Text The actual text string to be encrypted or decrypted

Output

The output JSON contains either an encrypted or decrypted field depending on the selected operation:

  • For encryption, the output JSON has the property:

    {
      "encrypted": "<encrypted_string>"
    }
    

    where <encrypted_string> is the DES-encrypted text encoded in the chosen encoding (Base64 or Hex).

  • For decryption, the output JSON has the property:

    {
      "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 API key credential containing the DES key (at least 32 characters long, used internally).
  • Uses the crypto-js library for cryptographic operations.
  • No additional external services are called.
  • The node expects the DES key to be provided via credentials configured in n8n.

Troubleshooting

  • Common issues:

    • Incorrect key length or invalid key format can cause decryption/encryption failures.
    • Mismatched mode or padding settings between encryption and decryption will result in incorrect output or errors.
    • Providing input text not properly encoded in the specified encoding (Base64/Hex) may cause parsing errors.
  • Error messages:

    • Errors thrown during encryption/decryption typically contain messages related to invalid ciphertext or padding issues.
    • If the node fails and "Continue On Fail" is disabled, execution stops immediately; enabling it allows processing subsequent items.
  • Resolution tips:

    • Verify the DES key length and format.
    • Ensure the same mode and padding are used consistently for both encryption and decryption.
    • Confirm the input text matches the expected encoding format.
    • Use "Continue On Fail" option to handle partial failures gracefully.

Links and References

Discussion