Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shared encryption method with openssl ?

Status
Not open for further replies.

zephan

Programmer
Joined
Jan 14, 2002
Messages
217
Location
A2
Hi,
What is the common algorithm, and the most secured one that is shared between dbms_obfuscation_toolkit package and openssl ? try to find one to load a crypted file (using openssl) on linux, and decrypt it later on user Oracle package.
Regards,
Zephan
 
You can take a look at thread822-1470134
Annihilic provided a nice solution, to my problem, which was to encrypt values separately and to store them in a file.
I could load the file into the database.
Then I read the values from the database using dbms_obfuscation_toolkit.desencrypt function. I tried to utl_encode.base64_decode the values I read, before to decrypt them. I tried to do it after encryption. It never decrypt the values correctly. What is wrong ?
Here below is my PL/SQL :
Code:
DECLARE 
somevar  RAW(128) ;
someinput  RAW(128) ;
key_data RAW(128) ;

CURSOR c_values  IS 
SELECT encryptedvalue  FROM encryptedtable ;

BEGIN

key_data := utl_raw.CAST_TO_RAW('thisisthekeyIusedinunixwithopenssl') ;

FOR rec IN c_values  LOOP 
someinput:= UTL_ENCODE.BASE64_DECODE(utl_raw.cast_to_raw(rec.encryptedvalue) );
DBMS_OBFUSCATION_TOOLKIT.DES3DECRYPT(INPUT =>someinput  ,KEY=>key_data ,
DECRYPTED_string => somevar ) ;
dbms_output.put_line(utl_raw.CAST_TO_VARCHAR2(somevar)) ;
END LOOP ; 
END ;

The other variant is to decode base64 the decrypted raw variable, the result is not better.

As for reference, here below is Annihilics code :

Code:
$ cat input
one
two
three
$ while read line ; do echo $line | openssl enc -des -base64 -pass pass:KenSentMe ; done < input > output
$ cat output
U2FsdGVkX1+ngxCnjqgILpnf0KSW4ysu
U2FsdGVkX1+o0txc6Rb2S3QWONNKlBdV
U2FsdGVkX1+L2RuXuN1fgC2sl2AmE9pL
$ while read line ; do echo $line | openssl enc -d -des -base64 -pass pass:KenSentMe ; done < output
one
two
three
$

I slightly changed enc command, I used -k instead of -pass (it neither worked with -pass).

Please help :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top