StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor(); encryptor.setPassword("jasypt"); // we HAVE TO set a password encryptor.setAlgorithm("PBEWithHMACSHA512AndAES_256"); // optionally set the algorithm encryptor.setIvGenerator(new RandomIvGenerator()); // for PBE-AES-based algorithms, the IV generator is MANDATORY ... String encryptedText = encryptor.encrypt(myText); ... String plainText = encryptor.decrypt(encryptedText); // myText.equals(plainText)
I intend to use Jasypt PBE for text encryption and decryption and based on the above code snippet I will be storing the key that is used in
encryptor.setPassword("jasypt") as an environment variable or properties.
So, my concern here is, will it be ok to store this key as plaintext or it needs to be Base64 encoded or encrypted because if we talk about encryption then again there will be another key which will be used to encrypt the key.