From: jmiranda <jm...@gm...> - 2009-02-03 19:52:48
|
Hi! I would like to encrypt some attributes of an entity in a transparent way when I persist it into database using Hibernate. I've followed the guide: http://www.jasypt.org/hibernate3.html and it works like a charm. The problem is that when I want to get back the entity from database I would like to get the entity with all attributes decryted. I don't know if I am missing something important but I get the attributes encrypted. I've followed all the steps of the guide. Any ideas?. Thanks in advance. -- View this message in context: http://www.nabble.com/Jasypt-%2B-Hibernate3-integration-%2B-decrypt-tp21817476s21332p21817476.html Sent from the Jasypt - Users mailing list archive at Nabble.com. |
From: jmiranda <jm...@gm...> - 2009-02-06 09:27:16
|
Solved. Everything works well doing some executions, I initialize Spring container (is a web app) 5 or 6 times and then... Caused by: org.jasypt.exceptions.EncryptionInitializationException: No string encryptor registered for hibernate with name "strongHibernateStringEncryptor" at org.jasypt.hibernate.type.AbstractEncryptedAsStringType.checkInitialization(AbstractEncryptedAsStringType.java:250) at org.jasypt.hibernate.type.AbstractEncryptedAsStringType.nullSafeGet(AbstractEncryptedAsStringType.java:142) at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105) at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81) Any ideas?. jmiranda wrote: > > Hi! > > I would like to encrypt some attributes of an entity in a transparent way > when I persist it into database using Hibernate. I've followed the guide: > http://www.jasypt.org/hibernate3.html and it works like a charm. > > The problem is that when I want to get back the entity from database I > would like to get the entity with all attributes decryted. I don't know if > I am missing something important but I get the attributes encrypted. > > I've followed all the steps of the guide. Any ideas?. > > Thanks in advance. > -- View this message in context: http://www.nabble.com/Jasypt-%2B-Hibernate3-integration-%2B-decrypt-tp21817476s21332p21869193.html Sent from the Jasypt - Users mailing list archive at Nabble.com. |
From: bornleo <pan...@re...> - 2009-02-08 07:41:07
|
You need to make an entry of strongHibernateStringEncryptor in your spring context i.e. applicationConext.xml in my case. Something like this. <bean id="strongHibernateStringEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"> <property name="algorithm"> <value>PBEWithMD5AndTripleDES</value> </property> <property name="password"> <value>jasypt</value> </property> </bean> Hope this helps. Leo. jmiranda wrote: > > Solved. > > Everything works well doing some executions, I initialize Spring container > (is a web app) 5 or 6 times and then... > > Caused by: org.jasypt.exceptions.EncryptionInitializationException: No > string encryptor registered for hibernate with name > "strongHibernateStringEncryptor" > at > org.jasypt.hibernate.type.AbstractEncryptedAsStringType.checkInitialization(AbstractEncryptedAsStringType.java:250) > at > org.jasypt.hibernate.type.AbstractEncryptedAsStringType.nullSafeGet(AbstractEncryptedAsStringType.java:142) > at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105) > at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81) > > Any ideas?. > > > jmiranda wrote: >> >> Hi! >> >> I would like to encrypt some attributes of an entity in a transparent way >> when I persist it into database using Hibernate. I've followed the guide: >> http://www.jasypt.org/hibernate3.html and it works like a charm. >> >> The problem is that when I want to get back the entity from database I >> would like to get the entity with all attributes decryted. I don't know >> if I am missing something important but I get the attributes encrypted. >> >> I've followed all the steps of the guide. Any ideas?. >> >> Thanks in advance. >> > > -- View this message in context: http://www.nabble.com/Jasypt-%2B-Hibernate3-integration-%2B-decrypt-tp21817476s21332p21896622.html Sent from the Jasypt - Users mailing list archive at Nabble.com. |
From: jmiranda <jm...@gm...> - 2009-02-08 10:12:45
|
Hi Leo, yes I had this piece of configuration. Maybe I was missing something. At the end I've created a spring bean and inside I've used jasypt to encrypt/decrypt, then I have to get the bean and call decrypt/encrypt everytime I want to get/update my entity but doesn't matter, is just in one time and it does not supose a big headchache :) Thanks for your help. bornleo wrote: > > You need to make an entry of strongHibernateStringEncryptor in your spring > context i.e. applicationConext.xml in my case. > > Something like this. > > <bean id="strongHibernateStringEncryptor" > class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"> > <property name="algorithm"> > <value>PBEWithMD5AndTripleDES</value> > </property> > <property name="password"> > <value>jasypt</value> > </property> > </bean> > > Hope this helps. > > Leo. > > > jmiranda wrote: >> >> Solved. >> >> Everything works well doing some executions, I initialize Spring >> container (is a web app) 5 or 6 times and then... >> >> Caused by: org.jasypt.exceptions.EncryptionInitializationException: No >> string encryptor registered for hibernate with name >> "strongHibernateStringEncryptor" >> at >> org.jasypt.hibernate.type.AbstractEncryptedAsStringType.checkInitialization(AbstractEncryptedAsStringType.java:250) >> at >> org.jasypt.hibernate.type.AbstractEncryptedAsStringType.nullSafeGet(AbstractEncryptedAsStringType.java:142) >> at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105) >> at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81) >> >> Any ideas?. >> >> >> jmiranda wrote: >>> >>> Hi! >>> >>> I would like to encrypt some attributes of an entity in a transparent >>> way when I persist it into database using Hibernate. I've followed the >>> guide: http://www.jasypt.org/hibernate3.html and it works like a charm. >>> >>> The problem is that when I want to get back the entity from database I >>> would like to get the entity with all attributes decryted. I don't know >>> if I am missing something important but I get the attributes encrypted. >>> >>> I've followed all the steps of the guide. Any ideas?. >>> >>> Thanks in advance. >>> >> >> > > -- View this message in context: http://www.nabble.com/Jasypt-%2B-Hibernate3-integration-%2B-decrypt-tp21817476s21332p21897350.html Sent from the Jasypt - Users mailing list archive at Nabble.com. |
From: Allan L. <lan...@gm...> - 2009-11-30 10:15:35
|
I've also recently hit the "No string encryptor registered for hibernate..." error and I'm also using Spring. The solution I found to the intermittent initialisation problem was to make my data access components dependent on the strongHibernateStringEncryptor bean, thereby ensuring that bean was always present in the application context before any of my data access components might start to try doing anything requiring en/decryption. I think I hit the problem because another of the beans in my Spring definition performed some data access as part of the execution of its init-method, and I guess there is no guarantee that this is called after all other beans have been instantiated. So anyway, long explanation, but simple solution. Try adding something like this, shown here on another bean which forms part of my data access infrastructure: <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" depends-on="hibernateStringEncryptor"> <property name="sessionFactory" ref="sessionFactory" /> ... </bean> <bean id="hibernateStringEncryptor" class="org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor"> <property name="registeredName" value="strongHibernateStringEncryptor"/> <property name="password" value="..." /> </bean> Hope that helps. Allan bornleo wrote: > > You need to make an entry of strongHibernateStringEncryptor in your spring > context i.e. applicationConext.xml in my case. > > Something like this. > > <bean id="strongHibernateStringEncryptor" > class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor"> > <property name="algorithm"> > <value>PBEWithMD5AndTripleDES</value> > </property> > <property name="password"> > <value>jasypt</value> > </property> > </bean> > > Hope this helps. > > Leo. > > > jmiranda wrote: >> >> Solved. >> >> Everything works well doing some executions, I initialize Spring >> container (is a web app) 5 or 6 times and then... >> >> Caused by: org.jasypt.exceptions.EncryptionInitializationException: No >> string encryptor registered for hibernate with name >> "strongHibernateStringEncryptor" >> at >> org.jasypt.hibernate.type.AbstractEncryptedAsStringType.checkInitialization(AbstractEncryptedAsStringType.java:250) >> at >> org.jasypt.hibernate.type.AbstractEncryptedAsStringType.nullSafeGet(AbstractEncryptedAsStringType.java:142) >> at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105) >> at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81) >> >> Any ideas?. >> >> >> jmiranda wrote: >>> >>> Hi! >>> >>> I would like to encrypt some attributes of an entity in a transparent >>> way when I persist it into database using Hibernate. I've followed the >>> guide: http://www.jasypt.org/hibernate3.html and it works like a charm. >>> >>> The problem is that when I want to get back the entity from database I >>> would like to get the entity with all attributes decryted. I don't know >>> if I am missing something important but I get the attributes encrypted. >>> >>> I've followed all the steps of the guide. Any ideas?. >>> >>> Thanks in advance. >>> >> >> > > -- View this message in context: http://old.nabble.com/Jasypt-%2B-Hibernate3-integration-%2B-decrypt-tp21817476s21332p26572211.html Sent from the Jasypt - Users mailing list archive at Nabble.com. |