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 joane,
i had the same problem and the solution was encoding IV in base64.
local!encryptedData: encrypttext( valueToEncrypt: ri!valueToEncrypt, iv: encodebase64string(local!iv), scsKey: local!scs.externalSystemKey, scsField: local!scs.fieldKey, cipher: local!cipher, ),
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"
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.
Hi Luis Miguel some things to note here:
1. I believe the SCS field key is always converted to lower case. Instead of "Key", must be "key"
2. Plugin functions are called using order-based parameters, I believe it does not support key-based as what you are trying to do. The third parameter is expected to be they SCS Key name, which is "Key" in your example.
What you need to do instead is like this:
local!eas: fn!encrypttext( local!valor, local!iv, "pruebaencript", "key", )
Added note: you're not generating the IV correctly.
Hi cindyv0001 I'm working on recompiling the plugin using JDK 17. I'll try and have it available by next week.
Does anyone know how to reach the author of the plug-in?
Hi, our Appian version has been upgraded to 24.2, we also upgraded JDK from version 8 to 17 on our Appian servers. We were told by Appian support to recompile our plug-ins using Java 17. Which version of JDK did you use to compile this plug-in? Could you recompile it using JDK 17? We have been using this plugin for over two years. It works very well. Thank you very much!
Good afternoon,
I am having a problem when using the plugin, both for encrypttext and decrypttext.
I am trying to access via SCS and I always get the error "Error encrypting value: This plug-in [com.unionbankph.plugins.aesencrypt] is not registered to access secured values for the given external system key [Key]. Check the external systems plug -ins list in the Administration Console." even though the plugin is correctly in the credential's plugin list. I am currently using them in the following way
local!base64Key: decodebase64string("pruebaencript"), local!eas: fn!encrypttext( valueToEncrypt: local!valor, scsKey: "pruebaencript", scsField:"Key", iv: local!base64Key ),
Thank you so much