Encryption Functions

Overview

Allows for the encryption and decryption of text data using symmetric AES encryption. This plug-in uses standard Java cryptography functions to expose expression functions for the encryption and decryption of data using AES.

Key Features & Functionality

Functions:

  • encryptvalue(): Encrypt plain text data using an AES encryption key stored in the Secure Credentials Store
  • decryptvalue(): Decrypt encrypted text data using an AES encryption key stored in the Secure Credentials Store

Features:

  • Supports up to 256-bit AES keys when JCE Unlimited Strength Jurisdiction Policy is enabled
  • Backwards compatible with older versions of Java lacking support for >128-bit encryption keys
Anonymous
  • Hi Jussi,

    We are trying to use your plug in for AES 256 bit encryption. Our use case is such that Appian encrypts a value and shares it with external system, and the external system decrypts the value and persists in their data base.

    We noticed that every time we encrypt a value like let's say "123" with the same encryption key the encrypted value keeps changing. Is that normal because the external system is unable to decrypt it? When I am looking online at other encryption/decryption tools, as long as the value we are trying to encrypt and key remain same the encrypted value is also staying constant.

    Any help in this matter is much appreciated.

    Thank you

  • Got it. Thanks for the detailed explanation Jussi.

  • Hi ,

    Great question. The reason each encrypted value starts with "AAAAE" is that the first item in the underlying byte buffer representing the encrypted value is the length of the initialization vector. (This can be found in the source code in EncryptText.java:151). Since the initialization vector is always 16 bytes long, the first 4 bytes of the array are always [0,0,0,16]. When the byte array is Base64 encoded, this translates to "AAAAE". If you want to, you can run the following Java code to validate:

    import java.nio.ByteBuffer;
    import java.util.Base64;
    
    public class Base64Bytes {
    
         public static void main(String []args){
            ByteBuffer buffer = ByteBuffer.allocate(4);
    		
    		buffer.putInt(16);
    		byte[] byteArray = buffer.array();
    		
    		Base64.Encoder encoder = Base64.getEncoder();
    		String encodedString = encoder.encodeToString(byteArray);
    		
    		System.out.println("# Byte array");
    		
    		for (int i = 0; i < byteArray.length; i++) {
    		    System.out.println(byteArray[i]);
    		}
    		
    		System.out.println(encodedString);
         }
    }


    Regarding salting, using a random initialization vector functionally achieves the same thing as salting, ensuring each encrypted value is unique despite having the same underlying plaintext.

    Hope this clarified your question!

    Best,
    Jussi

  • Hi Jussi - Thanks for building and sharing this! A question, when using this to encrypt, the resulting ciphertext always begins with "AAAAE". Is this meant to be like an indicator that ciphertext has been salted?

  • Hi Venu,

    The plugin itself does not have a method for generating the encryption key. You can use a free online service, plenty can be found just via a Google search for "aes-256 encryption key generator". I don't want to recommend a particular one, you should check with your client/information security department to check if they have a preferred method for generating encryption keys.

    Jussi

  •  
    I am trying to use this plug-in to encrypt/decrypt test. Can you tell me how can I generate encryptdecryptkey.
    Is there any online service? or plug-in itself has a feature to generate it.

    TIA.
    Venu.

  • Thanks Jussi - this seems to be a like for like replacement for the Plug In that has disappeared from the App Market.

    Our current use case is to encrypt the text values input to either text fields or paragraph fields - so this seems to be a direct replacement which we can start to look at how we migrate and re-encrypt the data accordingly.

    Many thanks for the quick response. 

    Cheers

    Paul 

  • Hi , if you are asking whether the plug-in supports encrypting values that users input into a Paragraph Field, yes, this will work.

    However, please note that the plugin does not add any additional encryption to the actual paragraph field component, unlike the native a!encryptedTextField functionality.

  • Hi Jussi - does the Plug In allow encryption of paragraph text fields ? The plug in we are using at the moment to do paragraph field encryption has disappeared from the App Market so am looking for alternatives that achieve the same outcome as what we have now. 

    Many thanks

    Paul

  • @agustinc Good to hear! Thanks for your interest in the plugin.