AES icon

AES

Use AES to encrypt or decrypt data

Overview

This node performs AES (Advanced Encryption Standard) encryption and decryption on input text data. It supports multiple AES modes of operation 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 with systems that require AES-encrypted payloads in specific modes and paddings.

For example, a user might encrypt a password or API key using AES-CBC mode with PKCS7 padding and Base64 encoding before saving it to a database. Later, the same node can decrypt the stored value back to plaintext when needed.

Properties

Name Meaning
Mode The AES mode of operation 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 encoding format for input/output ciphertext. 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 selected operation:

  • For encryption, the output JSON has an encrypted property holding the encrypted string encoded as specified (Base64 or Hex).
  • For decryption, the output JSON has a decrypted property holding the decrypted plaintext string.

No binary data output is produced by this node; all data is handled as strings.

Example output after encryption:

[
  {
    "encrypted": "U2FsdGVkX1+..."
  }
]

Example output after decryption:

[
  {
    "decrypted": "my secret text"
  }
]

Dependencies

  • This node depends on the crypto-js library for AES cryptographic functions.
  • It requires an API key credential containing a key string at least 32 characters long, which is split into two 16-byte parts used as the AES key and initialization vector (IV).
  • No additional environment variables or external services are required.

Troubleshooting

  • Invalid key length or missing key: The AES key must be at least 32 characters long. If the key is shorter or missing, encryption/decryption will fail.
  • Incorrect mode or padding: Using incompatible mode and padding combinations may cause errors or incorrect results.
  • Malformed input text: Decryption expects properly encoded ciphertext matching the selected encoding (Base64 or Hex). Invalid input will cause decryption errors.
  • Error messages: Errors thrown typically contain messages from the underlying crypto library, such as "Malformed UTF-8 data" or "Invalid padding". To resolve, verify the input text, key, mode, and padding settings.
  • Continue on Fail: The node supports continuing execution on failure, returning error messages in the output JSON instead of stopping the workflow.

Links and References

Discussion