GeeCON Prague 2014*
The moose likes JDBC and the fly likes Help in DBMS_OBFUSCATION_TOOLKIT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Help in DBMS_OBFUSCATION_TOOLKIT" Watch "Help in DBMS_OBFUSCATION_TOOLKIT" New topic
Author

Help in DBMS_OBFUSCATION_TOOLKIT

Anand Barhate
Greenhorn

Joined: Mar 09, 2009
Posts: 1
Hello,
I am trying to use DBMS_OBFUSCATION_TOOLKIT to encrypt and decrypt some data.

Here is the prog for that but when I use returned data for decrypting using same key I do not get same results.
Am I missing some step.

String encryptionKey="tiger123";

String encryptedString = "";



try {

CallableStatement cstmt;



con = dataSource.getConnection();

String procedureCall = "{call dbms_obfuscation_toolkit.DES3Encrypt(INPUT_STRING =>?,KEY_STRING=>?,ENCRYPTED_STRING=>?)}";

//String procedureCall = "{call crypt_util.crypt(p_str =>?,p_key=>?)}";



cstmt = con.prepareCall(procedureCall);

cstmt.setString(1, "anand123");

cstmt.setString(2, encryptionKey);

cstmt.setString(3, encryptedString);



cstmt.registerOutParameter(3, Types.VARCHAR);



cstmt.executeUpdate();



encryptedString = cstmt.getString(3);



System.out.println("encryptedString " + encryptedString);



cstmt.close();

}

catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

catch(Exception ce) {

logError(ce);

}

finally {

try {

con.close();

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}


Any help will be much appreciated..

Thanks,
Anand
 
GeeCON Prague 2014
 
subject: Help in DBMS_OBFUSCATION_TOOLKIT