[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Calling Oracle's Cryptit.encrypt()/Cryptit.decrypt() from Java?

Posted on 2005-05-07
6
Medium Priority
?
869 Views
Last Modified: 2012-08-13
Is there a way to call Oracle's Cryptit.encrypt()/Cryptit.decrypt() from Java?
I need to do something like
Insert into x values(a,b,c,Cryptit.encrypt(passwd,'key');

But my problem is that I don't get to create the query myself.
I only get to pass a String vector to this Java method which would create and run the query based the String query using preparedStatement and setString()

So, I figured if there is a way to call that Cryptit.encrypt() function in Java, I could just pass the resulting encryped String to the method...

Also, is there a way to run a Oracle function on ResultSet in Java?
Because I need to retrieve the encrypted password and then decrypt it before use... and again, I don't get to create the query such as "select Cryptit.decrypt(passwd, 'key')...", I only get the ResultSet

0
Comment
Question by:nagunpyo
  • 3
  • 2
6 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 1200 total points
ID: 13950786
If you can't alter the existing queries then i don't see a way myself. Something kludgy maybe such as using a temporary table where you *can* insert and select using your own query with that function ...
0
 
LVL 15

Assisted Solution

by:aozarov
aozarov earned 800 total points
ID: 13951461
If you have no control on the preparedStatement and you want to encrypt/decrypt the key (which is not already done) then you can try to
do that in java before settings to the PP and after getting from the RS.
There are many java implemention for that: just google: crypt java or unix like crypt java.
See some for example: http://www.dynamic.net.au/christos/crypt/
http://www.koders.com/java/fidBABB05F05C8511347014F2748AE1D75FA4491F3C.aspx
http://java.sun.com/developer/JDCTechTips/2004/tt0116.html
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13951618
Obviously if you use an implementation outside Oracle, it must be symmetrical with its implementation or you'll have difficulties with round trips
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:nagunpyo
ID: 13952448
thank you both of u... i ended up talking to the Method developer and modify the query.
0
 
LVL 15

Expert Comment

by:aozarov
ID: 13952521
That should be the best :-)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13953260
:-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month19 days, 7 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question