I am using Jasypt encryption and specifying the property value within ENC() in the properties file. The decryption password is sent through the command-line argument like this java -Djasypt.encryptor.password=somepassword -jar name.jar
. Everything is working fine but the problem is when I search for the running process, it shows the password as well. Is there a way to hide the encryption password as well by read it from somewhere?
I thought of using the environment variables but that could also expose the password as well. So, decided against it.
Update: There was a solution in another SO post Spring Boot How to hide passwords in Properties file?
The solution what I followed was to create an environment variable with the name JASYPT_ENCRYPTOR_PASSWORD
, execute the command java -jar name.jar
and then unset the environment variable. This worked as I intended.