I followed the  document on Password Encryption
<http://tomee.apache.org/datasource-password-encryption.html>   and found
that I keep getting the following exception when I try to define my own
cypher implementation...

Feb 25, 2014 4:17:10 PM org.apache.tomee.jdbc.TomEEDataSourceCreator
updateProperties
SEVERE: Can't decrypt password
java.sql.SQLException: Cannot load password cipher class 'mapped'
        at
org.apache.openejb.resource.jdbc.BasicDataSourceUtil.getPasswordCipher(BasicDataSourceUtil.java:141)
        at
org.apache.tomee.jdbc.TomEEDataSourceCreator.updateProperties(TomEEDataSourceCreator.java:132)
        at
org.apache.tomee.jdbc.TomEEDataSourceCreator.pool(TomEEDataSourceCreator.java:80)
        at
org.apache.openejb.resource.jdbc.DataSourceFactory.create(DataSourceFactory.java:135)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)

which (I think) means that it cant translate the contents of file 'mapped'
into the real class.

However when I (experimentally) put the class file name into <Resources>
instead of 'mapped'

i.e.
        <Resource id="ds" type="DataSource">
                JdbcDriver net.sourceforge.jtds.jdbc.Driver
                JdbcUrl jdbc:jtds:sqlserver://localhost:1433;DatabaseName=DB
                UserName sa
                Password encryptedXXXX
                JtaManaged true
                PasswordCipher mapped <---- This fails but 
"com.company.MyPasswordCypher"
works
        </Resource>

(Using Maven) I have a file called 'mapped' which contains single line
"com.company.MyPasswordCypher" in directory
"target/<APP>/META-INF/org.apache.openejb.resource.jdbc.PasswordCypher", and
of course I have class com.company.MyPasswordCypher implemented in my
project as required.

Is there anything obviously wrong with what I've done?

Many Thanks
Ian Hunter







--
View this message in context: 
http://openejb.979440.n4.nabble.com/Is-this-right-for-how-encrypted-DB-passwords-are-to-work-tp4667980.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to