-->
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.  [ 1 post ] 
Author Message
 Post subject: Need to compare encrypted data stored in DB
PostPosted: Wed May 04, 2011 11:37 am 
Newbie

Joined: Wed May 04, 2011 11:24 am
Posts: 1
Hi:

We are storing encrypted data in the tables. The encryption and decryption code is written in Java and is done before and after saving/retrieving data from the DB.

I am looking for a way to be able to query the database with a like statement. For example, if userName column in the table is storing encrypted data, is there a way to be able to query userName like '%xyz%'. As the data stored in userName column is encrypted byte data, simple select will not work. So I should be able to call a Java method to decrypted the data by calling a Java class in the select statement and do a like comparison.

I am using Hibernate named queries and therefore I would like to do something as follows:

Code:
select user from user myUser where com.myApp.Security.decrypt(myUser.userName) like '%xyz%

where com.myApp.Security.decrypt is a method in Security Java class which will know how to decrypt the byte data stored in the database to a String.

Is there a way to call a Java method embedded within the name query?

Or could you please provide any other way to accomplish what I am trying to do.

Your help is greatly appreciated.

Thanks
Ram


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

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.