Decryption not functioning with current configuration

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Decryption not functioning with current configuration

cmathrusse
I am attempting to utilize the password crypt/decrypt functionality associated with DataSources. However the decrypt appears to not function as expected with my configuration. I am utilizing BTM 1.2 with Spring 2.5. As you can see from the configuration below, I am using a properties file to contain the property configuration and utilizing Spring's PropertyPlaceholderConfigurer to expand those variables.

With the configuration below I am unable to log into the database as the encrypted password is not being decrypted.

  <bean id="ciimDataSourceTarget" class="bitronix.tm.resource.jdbc.DataSourceBean"> 
      <property name="className" value="${jdbc.ciim.driver.className}" /> 
      <property name="uniqueName" value="ciim-datasource" /> 
      <property name="poolSize" value="${jdbc.ciim.pool.size}" /> 
      <property name="driverProperties"> 
          <props> 
              <prop key="user">${jdbc.ciim.user}</prop> 
              <prop key="password">${jdbc.ciim.password}</prop> 
              <prop key="databaseName">${jdbc.ciim.db}</prop> 
              <prop key="portNumber">${jdbc.ciim.port}</prop> 
              <prop key="serverName">${jdbc.ciim.server.name}</prop> 
              <prop key="IGNORE_DONE_IN_PROC">true</prop> 
              <prop key="DISABLE_UNPROCESSED_PARAM_WARNINGS">true</prop> 
              <prop key="DYNAMIC_PREPARE">false</prop> 
              <prop key="BE_AS_JDBC_COMPLIANT_AS_POSSIBLE">true</prop> 
              <prop key="SERVER_INITIATED_TRANSACTIONS">true</prop> 
              <prop key="APPLICATIONNAME">${jdbc.application.name}</prop> 
          </props> 
      </property> 
      <property name="allowLocalTransactions" value="true"/> 
      <property name="testQuery" value="select 1 from sysobjects where 1 = 2"/> 
  </bean> 


Thanks for the help...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Decryption not functioning with current configuration

Ludovic Orban
Administrator
Hi,

The password decryption has been designed to only work with the ResourceLoader, not the API. This is a bug as I clearly documented that this should also work with the API.

I've opened JIRA issue BTM-7 to track progress.

I'll keep you posted when a fix is available.

Thanks for reporting this bug !
Ludovic
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Decryption not functioning with current configuration

cmathrusse
Thanks for the update...

I'll wait for the fix.

Ludovic Orban wrote
Hi,

The password decryption has been designed to only work with the ResourceLoader, not the API. This is a bug as I clearly documented that this should also work with the API.

I've opened JIRA issue BTM-7 to track progress.

I'll keep you posted when a fix is available.

Thanks for reporting this bug !
Ludovic
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Decryption not functioning with current configuration

Ludovic Orban
Administrator
There it is: http://snapshots.dist.codehaus.org/btm/btm-dist-1.3-20080129.zip

Please let me know if that version works for you.

Ludovic
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Decryption not functioning with current configuration

cmathrusse
Got it!! and it works great. No issues at all. The value within my properties file is encrypted utilizing the bitronix.tm.internal.CryptoEngine and BTM decrypts it upon startup.

Thanks so much for the fix and the quick response. It's greatly appreciated as always!

Ludovic Orban wrote
There it is: http://snapshots.dist.codehaus.org/btm/btm-dist-1.3-20080129.zip

Please let me know if that version works for you.

Ludovic
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Decryption not functioning with current configuration

Ludovic Orban
Administrator
You're welcome!

A bit unrelated but nevertheless useful, I noticed that your config is a bit outdated. I have two remarks about it:

1) You are still using pre-1.0 style resource creation using DataSourceBean.createResource(). This is still working but deprectated so I'd recommend you to upgrade to the latest way.

In short, you should change this:

<bean id="ciimDataSourceTarget" class="bitronix.tm.resource.jdbc.DataSourceBean">

with that:

<bean id="ciimDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close">

and get rid of the call to createResource() on the ciimDataSourceTarget bean. Check the Spring page for more details: http://docs.codehaus.org/display/BTM/Spring+Framework


2) poolSize property is now also deprecated. It has been replaced with both minPoolSize and maxPoolSize properties (as the pool can now grow and shrink). Setting poolSize basically sets both minPoolSize and maxPoolSize to the same value.

I'd recommend you to use minPoolSize and maxPoolSize properties now and set them to ${jdbc.ciim.pool.size} so this won't change behavior at all in your case and you won't use deprecated features anymore.

Please note that I'm not Sun so deprecated classes and methods will really be removed some day. Be ready !

Ludovic
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Decryption not functioning with current configuration

cmathrusse
Thanks for pointing that out. I've made the changes and all seems to be well.

The only bit of difference that I have in my configuration is where you define the PlatformTransactionManager.

You have:
<bean id="JtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
        <property name="transactionManager" ref="BitronixTransactionManager" />
        <property name="userTransaction" ref="BitronixTransactionManager" />
</bean>

While I have:
  <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    <constructor-arg >
      <ref local="bitronixTransactionManager"/>
    </constructor-arg>
  </bean>

With this declaration Spring automatically assigns the TransactionManager to the UserTransaction object in the folllowing method:

        protected UserTransaction buildUserTransaction(TransactionManager transactionManager) {
                if (transactionManager instanceof UserTransaction) {
                        return (UserTransaction) transactionManager;
                }
                else {
                        return new UserTransactionAdapter(transactionManager);
                }
        }

The effect is the same, I just like it better as the PlatformTransactionManager gets the TM right in the constructor. Clean and concise.

Thanks again for the help and the pointers.
Ludovic Orban wrote
You're welcome!

A bit unrelated but nevertheless useful, I noticed that your config is a bit outdated. I have two remarks about it:

1) You are still using pre-1.0 style resource creation using DataSourceBean.createResource(). This is still working but deprectated so I'd recommend you to upgrade to the latest way.

In short, you should change this:

<bean id="ciimDataSourceTarget" class="bitronix.tm.resource.jdbc.DataSourceBean">

with that:

<bean id="ciimDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource" init-method="init" destroy-method="close">

and get rid of the call to createResource() on the ciimDataSourceTarget bean. Check the Spring page for more details: http://docs.codehaus.org/display/BTM/Spring+Framework


2) poolSize property is now also deprecated. It has been replaced with both minPoolSize and maxPoolSize properties (as the pool can now grow and shrink). Setting poolSize basically sets both minPoolSize and maxPoolSize to the same value.

I'd recommend you to use minPoolSize and maxPoolSize properties now and set them to ${jdbc.ciim.pool.size} so this won't change behavior at all in your case and you won't use deprecated features anymore.

Please note that I'm not Sun so deprecated classes and methods will really be removed some day. Be ready !

Ludovic
Loading...