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

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

Who is Participating?
CEHJConnect With a Mentor Commented:
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 ...
aozarovConnect With a Mentor Commented:
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:
Obviously if you use an implementation outside Oracle, it must be symmetrical with its implementation or you'll have difficulties with round trips
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

nagunpyoAuthor Commented:
thank you both of u... i ended up talking to the Method developer and modify the query.
That should be the best :-)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.