Wednesday, April 29, 2009

How to encrypt Hibernate Database Password in hibernate_cfg.xml file

Configure Hibernate.cfg.xml with Encrypted password by Java Software Engineer Mar 26, 2008; 07:33pm :: Rate this Message: - Use ratings to moderate (?)

Reply | Reply to Author | Print | View Threaded | Show Only this Message
I am getting Exception when i configured Hibernate.cfg.xml with Encrypted password saying
Initial SessionFactory creation failed.org.jasypt.exceptions.EncryptionInitializationException: No string encryptor registered for hibernate with name "configurationHibernateEncryptor"
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.example.hibernate.util.HibernateUtil.(HibernateUtil.java:17)
at com.example.hibernate.util.EventManager.main(EventManager.java:17)
Caused by: org.jasypt.exceptions.EncryptionInitializationException: No string encryptor registered for hibernate with name "configurationHibernateEncryptor"
at org.jasypt.hibernate.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider.configure(EncryptedPasswordDriverManagerConnectionProvider.java:106)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at com.example.hibernate.util.HibernateUtil.(HibernateUtil.java:13)
... 1 more


My Hibernate.cfg.xml

"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">





org.jasypt.hibernate.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider


configurationHibernateEncryptor



oracle.jdbc.driver.OracleDriver


jdbc:oracle:thin:@localhost:1521:XE

system

ENC(bZHq6yRq4h2vSb2fRkP8HRQ3iTNQovU17I0AzgWDQ4Vq45SFrS2O3Y8UoAKszcH4)


1

org.hibernate.dialect.OracleDialect

thread


org.hibernate.cache.NoCacheProvider



true


create







To generate Encrypted password i used Command Line tool(encrypt) :

encrypt input="This is my message to be encrypted" password=MYPAS_WORD verbose=false


Re: Configure Hibernate.cfg.xml with Encrypted password by dfernandez Mar 26, 2008; 09:18pm :: Rate this Message: - Use ratings to moderate (?)

Reply | Reply to Author | Print | View Threaded | Show Only this Message
+------------------------+
Jasypt Users List
http://www.jasypt.org
+------------------------+

Hello,

You need to register an encryptor that will take care of the encryption
and decryption of your data. In your XML:


configurationHibernateEncryptor



This means that Jasypt will expect for an encryptor to be registered
with name "configurationHibernateEncryptor". This is explained in
http://www.jasypt.org/hibernate3.html, in "Providing the encryptor to
Hibernate" -> "Without Spring".

Regards,
Daniel.



Java Software Engineer wrote:
> +------------------------+
> Jasypt Users List
> http://www.jasypt.org
> +------------------------+
>
> I am getting Exception when i configured Hibernate.cfg.xml with Encrypted
> password saying
> Initial SessionFactory creation
> failed.org.jasypt.exceptions.EncryptionInitializationException: No string
> encryptor registered for hibernate with name
> "configurationHibernateEncryptor"
> Exception in thread "main" java.lang.ExceptionInInitializerError
> at com.example.hibernate.util.HibernateUtil.(HibernateUtil.java:17)
> at com.example.hibernate.util.EventManager.main(EventManager.java:17)
> Caused by: org.jasypt.exceptions.EncryptionInitializationException: No
> string encryptor registered for hibernate with name
> "configurationHibernateEncryptor"
> at
> org.jasypt.hibernate.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider.configure(EncryptedPasswordDriverManagerConnectionProvider.java:106)
> at
> org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
> at
> org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
> at
> org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
> at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
> at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
> at
> org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
> at com.example.hibernate.util.HibernateUtil.(HibernateUtil.java:13)
> ... 1 more
>
>
> My Hibernate.cfg.xml
>
> > "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
> "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
>
>
>
>
>
>
> org.jasypt.hibernate.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider
>

>
> configurationHibernateEncryptor
>

>
>
> oracle.jdbc.driver.OracleDriver

>
> jdbc:oracle:thin:@localhost:1521:XE

> system
>
>
> ENC(bZHq6yRq4h2vSb2fRkP8HRQ3iTNQovU17I0AzgWDQ4Vq45SFrS2O3Y8UoAKszcH4)

>
> 1
>
> org.hibernate.dialect.OracleDialect
>
> thread
>
>
> org.hibernate.cache.NoCacheProvider

>
>
> true
>
>
> create
>
>
>
>

>
>

>
> To generate Encrypted password i used Command Line tool(encrypt) :
>
> encrypt input="This is my message to be encrypted" password=MYPAS_WORD
> verbose=false
>
> ...[show rest of quote]

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
jasypt-users mailing list
jasypt-users@...

http://www.nabble.com/Configure-Hibernate.cfg.xml-with-Encrypted-password-td16319026s21332.html

Monday, April 6, 2009

Health IT links

https://www.google.com/health by Google.
http://www.healthvault.com/ by Microsoft
http://dossia.org/ by Dossia