4

I want to store password in encrypted format so it is not readable for other user. my tomee.xml file contains

<Resource id="jdbc/myrootdb" type="DataSource"> JdbcDriver com.mysql.jdbc.Driver JdbcUrl jdbc:mysql://localhost:3306/test UserName root Password root JtaManaged false InitialSize 50 MaxActive 10 MaxIdle 3 </Resource> 

I am using apache-tomee-jaxrs-1.5.2.

2 Answers 2

2

The <Resource> in Tomcat has an attribute called factory. Here you specify a datasource factory. For encrypted password you need a custom datasource factory which reads the encrypted password. Here is what you need

  1. An encryption/decryption algorithm for password.
  2. Custom datasource factory

For more details, please check out this very detailed step by step example for achieving the same.

Sign up to request clarification or add additional context in comments.

Comments

1
  1. Download standalone version of OpenEJB
  2. Go to <OpenEJB install path>/bin and execute the command
    openejb cipher root
  3. Copy the generated encrypted password to your datasource resource definition
  4. Add the property DataSourceCreator to your datasource resource definition:
    DataSourceCreator dbcp
  5. Add the property PasswordCipher to your datasource resource definition:
    PasswordCipher Static3DES

For more information see: http://openejb.apache.org/datasource-password-encryption.html

1 Comment

this is not secure for encrypt password. because user can easily decry pt the encrypted password

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.