Michael/JB, thanks for the response. Yes I followed the JB's  blog post and 
have the encrypted passwords working  for postgresql databases. Same code when 
used with MS SQL Server is not working with encrypted password enclosed in 
ENC(). MS SQL Server says "incorrect password". With plain text it is fine. I 
have the following in blueprint.xml

<enc:property-placeholder>
        <enc:encryptor 
class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
                <property name="config">
                        <bean 
class="org.jasypt.encryption.pbe.config.EnvironmentStringPBEConfig">
                                <property name="algorithm" 
value="PBEWithMD5AndDES" />
                                <property name="passwordEnvName" 
value="PASSWORD" />
                        </bean>
                </property>
        </enc:encryptor>
</enc:property-placeholder>

And following in properties file.

db1.driver=org.postgresql.Driver
db1.url=jdbc:postgresql://localhost:5432/db1
db1.user=user
db1.password=ENC(lkjalsdkalsdlksd;alk)

db2.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
db2.url=jdbc:sqlserver://localhost:1433;databaseName=db2
db2.user=user
db2.password=ENC(lkjalsdkalsdlksd;alk)

regards
Vinu
-----Original Message-----
From: Jean-Baptiste Onofré [mailto:[email protected]]
Sent: Wednesday, March 25, 2015 1:47 AM
To: [email protected]
Subject: Re: Jasypt encrypted passwords for MS SQL Server DB

By the way:

http://blog.nanthrax.net/2014/10/encrypt-configadmin-properties-values-in-apache-karaf/

Regards
JB

On 03/24/2015 12:43 PM, [email protected] wrote:
> Facing an issue with connecting to an MS SQL server database using
> Jasypt encrypted passwords. Same code is working fine with a
> postgresql database with same userid/password.  Database credentials
> are in a properties file loaded using configAdmin with blueprint.
> Properties file is as below
>
> db1.driver=org.postgresql.Driver
>
> db1.url=jdbc:postgresql://localhost:5432/db1
>
> db1.user=user
>
> db1.password=ENC(lkjalsdkalsdlksd;alk)
>
> db2.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
>
> db2.url=jdbc:sqlserver://localhost:1433;databaseName=db2
>
> db2.user=user
>
> db2.password=ENC(lkjalsdkalsdlksd;alk)
>
> If I remove the ENC enclosure and provide the plain text password for
> SQL Server database, everything is fine. Any issue reported specific
> to MS SQL Server ?
>
> -Vinu
>
> The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> addressee(s) and may contain proprietary, confidential or privileged
> information. If you are not the intended recipient, you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately and destroy all copies of this message and any attachments. 
> WARNING:
> Computer viruses can be transmitted via email. The recipient should
> check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus
> transmitted by this email. www.wipro.com

--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com
The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. WARNING: Computer viruses can be transmitted via email. The 
recipient should check this email and any attachments for the presence of 
viruses. The company accepts no liability for any damage caused by any virus 
transmitted by this email. www.wipro.com

Reply via email to