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:
Features:
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 edmund.loh,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); } }
Got it. Thanks for the detailed explanation Jussi.