Location: PL/SQL

Discussion: PL/SQL DES3 Encryption/Decryption

Keyword tags: PL/SQL PL/SQL Intro

Watch

Anonymous  (Get credit for your thread)


sabraha5

sabraha5
PL/SQL DES3 Encryption/Decryption
Jul 22 2008, 4:33 PM EDT
We are trying to decrypt data written to tables from a Java program which used javax.crypto.Cipher (Cipher.getInstance("DESede")) to encrypt the data ; the DBMS_OBFUSCATION_TOOLKIT has functions/procedures to perform DES3 functionality ; the Java program uses javax.crypto.SecretKeyFactory to generate the secretkey (keyfactory.generateSecret(new DESedeKeySpec(keyBytes))) which is used to do the actual encryption (cipher.init(mode, secretKey)) ; do I need to call the DES3GetKey with the key which was passed into the generateSecret method and then call the DES3Decrypt with the key returned from the DES3GetKey call? Do you find this valuable?    
sabraha5

sabraha5
RE: PL/SQL DES3 Encryption/Decryption
Jul 22 2008, 4:40 PM EDT
I am trying to use the DES3GetKey function from the DBMS_OBFUSCATION_TOOLKIT package as below and getting the following error...

ORA-06550: line 5, column 3:
PLS-00307: too many declarations of 'DES3GETKEY' match this call
ORA-06550: line 5, column 3:
PL/SQL: Statement ignored

DECLARE
l_key VARCHAR2(60) := 'testkey';
l_raw RAW(60);
BEGIN
DBMS_OBFUSCATION_TOOLKIT.DES3GetKey(
DBMS_OBFUSCATION_TOOLKIT.TwoKeyMode
, UTL_RAW.cast_to_raw(l_key)
, l_raw);


DBMS_OUTPUT.put_line('Key : ' || UTL_RAW.cast_to_varchar2(l_raw));
END;

I am getting same error trying to use the DES3Encrypt and DES3Decrypt functions also. Do I have to specify the call to the function differently? Thanks!
Do you find this valuable?    

Related Content

  (what's this?Related ContentThanks to keyword tags, links to related pages and threads are added to the bottom of your pages. Up to 15 links are shown, determined by matching tags and by how recently the content was updated; keeping the most current at the top. Share your feedback on Wetpaint Central.)