AES icon

AES

Use AES to encrypt or decrypt data

Overview

This node performs AES (Advanced Encryption Standard) encryption and decryption on input data. It supports multiple AES modes of operation and padding schemes, allowing users to customize the cryptographic process according to their needs.

Common scenarios where this node is beneficial include:

  • Securely decrypting sensitive data received from external sources.
  • Encrypting data before storing or transmitting it to ensure confidentiality.
  • Integrating with systems that require AES-encrypted payloads in specific modes and paddings.

For example, a user might decrypt an incoming Base64-encoded ciphertext using AES-CBC mode with PKCS7 padding to retrieve the original plaintext string.

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 of the input/output text. Options: Base64, Hex
Type The type of data to process. Currently only "String" is supported
Text The actual text string to encrypt or decrypt

Output

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

  • For Decrypt operation:
    {
      "decrypted": "<decrypted UTF-8 string>"
    }
    
  • For Encrypt operation:
    {
      "encrypted": "<encrypted string in selected encoding>"
    }
    

The output is always a UTF-8 string representation of the processed data. This node does not output binary data directly.

Dependencies

  • Requires an API key credential containing the AES key (at least 32 characters long).
  • Uses the crypto-js library internally for AES operations.
  • No additional environment variables are needed beyond the AES key credential.

Troubleshooting

  • Common issues:

    • Providing an AES key shorter than 32 characters will cause errors.
    • Using incompatible padding or mode combinations may result in failed encryption/decryption or corrupted output.
    • Input text must be correctly encoded as per the selected encoding option (Base64 or Hex).
  • Error messages:

    • Errors during encryption/decryption typically indicate invalid keys, incorrect padding, or malformed input text.
    • If the node throws an error about missing credentials, ensure the AES key credential is properly configured.
  • Resolution tips:

    • Verify the AES key length and format.
    • Confirm the input text matches the expected encoding.
    • Test different padding and mode settings if decryption fails.

Links and References

Discussion