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

Posted on 2005-05-07
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

Question by:nagunpyo
    LVL 86

    Accepted Solution

    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 ...
    LVL 15

    Assisted Solution

    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:
    LVL 86

    Expert Comment

    Obviously if you use an implementation outside Oracle, it must be symmetrical with its implementation or you'll have difficulties with round trips

    Author Comment

    thank you both of u... i ended up talking to the Method developer and modify the query.
    LVL 15

    Expert Comment

    That should be the best :-)
    LVL 86

    Expert Comment


    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    MaxSpan challenge 9 52
    classnotfoundexception 3 29
    Return ZipOutputStream using Servlet 2 27
    Systems talking to each other 5 73
    For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now