Reputation: 931
I am trying to encrypt all the plain text keys and passwords in my J2EE application. I am trying to find out the best way to do so.
I understand that JASYPT has a very good library and utility for encrypting properties file,but doesn't seem to work in case of persistence.xml, which has all db usernames and passwords.
Following is the development stack:
Upvotes: 1
Views: 3673
Reputation: 931
Jasypt itself has a good solution for the above problem.
By using an org.jasypt.properties.EncryptableProperties object, an application would be able to correctly read and use a .properties file like this:
datasource.driver=com.mysql.jdbc.Driver
datasource.url=jdbc:mysql://localhost/reportsdb
datasource.username=reportsUser
datasource.password=ENC(G6N718UuyPE5bHyWKyuLQSm02auQPUtm)
Note that the database password is encrypted (in fact, any other property could also be encrypted, be it related with database configuration or not).
More information :
http://www.jasypt.org/encrypting-configuration.html
http://appfuse.org/display/APF/Database+Encryption+with+Jasypt-Hibernate
Upvotes: 2