-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Encryption of data in Hibernate
PostPosted: Fri Mar 05, 2010 2:06 am 
Newbie

Joined: Fri Mar 05, 2010 1:51 am
Posts: 1
I am new to Hibernate. Before using it, i would like to know whether there is a way to encrypt the data before inserting into database and decrypting it after fetching from database?

After a bit searching, I found Jasypt. But it needs the password to be stored in XML configuration file.

In my case, the password changes from table to table and should not be stored in the XML file. Is there anyway that I can get this done in Hibernate?


Top
 Profile  
 
 Post subject: Re: Encryption of data in Hibernate
PostPosted: Fri Mar 05, 2010 4:37 am 
Newbie

Joined: Sun Feb 14, 2010 8:08 am
Posts: 12
Have you taken a look at "org.hibernate.Interceptor", if you have your own module which does encryption/decryption then you can use interceptor to encrypt the data before inserting and decrypt it after fetching from database. You can find details of interceptor at http://docs.jboss.org/hibernate/core/3.3/reference/en/html/events.html


Top
 Profile  
 
 Post subject: Re: Encryption of data in Hibernate
PostPosted: Fri Mar 05, 2010 4:56 am 
Regular
Regular

Joined: Thu May 07, 2009 5:56 am
Posts: 94
Location: Toulouse, France
I think you can use Listerners (callback @PrePersit and @PostLoad for encryption/decryption respectively). Or as cited mpujari80, the Interceptor (but I think more difficult and it's not JPA)

_________________
everything should be made as simple as possible, but not simpler (AE)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.