-->
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.  [ 2 posts ] 
Author Message
 Post subject: crypt data with hibernate
PostPosted: Thu Jun 15, 2006 1:03 pm 
Newbie

Joined: Thu Jun 15, 2006 12:04 pm
Posts: 1
Hi all!
I have a problem crypting data with hibernate,
I want to crypt username and password using hsm.

I supposed that I could do it automatically in Hibernate pojo Object through getter and setter methods... like:

public java.lang.String getUsername() {
return Crypt.getDecrypted(this.username);
}

public void setUsername(java.lang.String username){
this.username = Crypt.getEncrypted(username);
}

unfortunately when Hibernate sets data into db,
it pass by getter method calling getUsername(),
so the name is written into db decripted with no effects.

Do you know some trick to help me crypting and decrypting
data?
it will save me to do it manually every time the data is displayed.
Thanks a lot


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 15, 2006 3:32 pm 
Expert
Expert

Joined: Fri Aug 19, 2005 2:11 pm
Posts: 628
Location: Cincinnati
make the fields a custom user type and encrypt them there. The custom user types define methods that are called when it writes the field value to the prepared statement

_________________
Chris

If you were at work doing this voluntarily, imagine what you'd want to see to answer a question.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.