+------------------------+
Jasypt Users List
http://www.jasypt.org
+------------------------+
I am using spring 2.5 + hibernate 3. I am trying to encrypt my user password field. I set up an encryptor in spring as such:
<bean id="hibernateStringEncryptor"
class="org.jasypt.hibernate.encryptor.HibernatePBEStringEncryptor">
<property name="registeredName">
<value>strongHibernateStringEncryptor</value>
</property>
<property name="algorithm">
<value>PBEWithMD5AndTripleDES</value>
</property>
<property name="password">
<value>mypassword</value>
</property>
</bean>
In my user class mapping I have the following:
<hibernate-mapping auto-import="true">
<typedef name="encryptedString" class="org.jasypt.hibernate.type.EncryptedStringType">
<param name="encryptorRegisteredName">strongHibernateStringEncryptor</param>
</typedef>
.
<class name="User" table="USERS">
<id access="field" column="id" name="id" type="int" unsaved-value="-1">
<generator class="sequence">
<param name="sequence">SEQ_USERS</param>
</generator>
</id>
<property column="USERNAME" name="username" not-null="true" type="string"/>
<property column="PASSWORD" name="password" not-null="true" type="encryptedString"/>
When I create a new user, the password is properly encrypted. I can also query users via load or through the object map and I tested that the password is being decrypted.
***However, I can not query a user using the password field:
String query = "select user from User user where active=? and username=? and password=?";
List results = getHibernateTemplate().find(query, new Object[]{true, userName, password});
I get no results whenever I query using the encrypted field. What am I doing wrong?
thanks
-ryan
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects_______________________________________________
jasypt-users mailing list
jasypt-users@...
https://lists.sourceforge.net/lists/listinfo/jasypt-users