Overview
Encrypt and decrypt sensitive text data using AES
Key Features & FunctionalityEncryption and decryption using AES with option to format the output as hex or base64.
Hello,
We're currently doing some encryption tests with the AES Encrypt plugin, but we've come across an error that seems quite strange to us. If we have an iv with the 16 bytes requested, we get the following error:
"Error encrypting value: IV must be 16 bytes long."
Could you help us? I send the code we are using below.
local!encryptedData: encrypttext( valueToEncrypt: ri!valueToEncrypt, iv: local!iv, scsKey: local!scs.externalSystemKey, scsField: local!scs.fieldKey, cipher: local!cipher, ),
Thank you in advance.
Can you share how you've generated the IV?
The function is expecting the input to be in Base64 format.
Using openssl, you may use the sample command below to generate such
openssl rand -base64 16
Using Appian, you may also generate using script below (note: you may need to install Base64 Expressions plugin)
hex2base64(randombytes(16))
The cipher variable is local!cipher: "AES/CBC/PKCS7Padding"