Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help in DBMS_OBFUSCATION_TOOLKIT

 
Anand Barhate
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic