views:

259

answers:

2

I am using Spring, Hibernate for developing my application. And as DB side, I have MySQL. I have an User table and that has password field of varchar type.

Now, when a new user is created, I just want store password field in an encrypted form. Is there any facility provided by Hibernate to do so? Or is there any other way?

+3  A: 

You might want to take a look at this thread which provides good answers for the same question:

http://stackoverflow.com/questions/1075128/password-encryption-with-spring-hibernate-jasypt-or-something-else

In short, using a one-way hashing algorithm with salt to encrypt the password is the de-facto way of doing this.

Olly
A: 

I have resolve this issue by creating one trigger in mysql.

So, whenever any record created for User Table, it will fetch the password of that field and converted the password into encrypted form supported by mysql in-built function.

Nirmal