Home » RDBMS Server » Server Administration » please help me on the encrypt and decrypt
please help me on the encrypt and decrypt [message #371433] Wed, 18 October 2000 15:58 Go to next message
Prabhakar Allathur
Messages: 10
Registered: October 2000
Junior Member
Hi Prem,
I did connect as SYS and ran both the scripts
run dbmsobtk.sql and prvtobtk.plb
Grant execute on dbms_obfuscation_toolkit to public
Now they want me to write the 2 functions to to encrypt and decrypt. Is that the next step or will you please help me because this is my time and I have no clue please help me
Thank you in advance
please as special request, Thanks again
Re: please help me on the encrypt and decrypt [message #371438 is a reply to message #371433] Thu, 19 October 2000 05:38 Go to previous messageGo to next message
Prem
Messages: 79
Registered: August 1998
Member
Prabhakar,

you owe me a chocolate treat for this :)
here it is

CREATE OR REPLACE FUNCTION FN_ENCR_VALUE (PINPUT_STRING VARCHAR2 DEFAULT NULL) RETURN VARCHAR2 IS
TSTRING_INPUT VARCHAR2(16) := LPAD(NVL(PINPUT_STRING,'0'), 16, '0');
TRAW_INPUT RAW(128) := UTL_RAW.CAST_TO_RAW (TSTRING_INPUT);
TSTRING_OUTPUT VARCHAR2(2048);
TRAW_OUTPUT RAW(2048);

TSTRING_KEY VARCHAR2(16) := 'DONTTELLTHISLOUD';
TRAW_KEY VARCHAR2(128) := UTL_RAW.CAST_TO_RAW(TSTRING_KEY);
BEGIN
DBMS_OBFUSCATION_TOOLKIT.DESENCRYPT ( input => TRAW_INPUT, key => TRAW_KEY, encrypted_data => TRAW_OUTPUT);
RETURN RAWTOHEX(TRAW_OUTPUT);
END;
/

I havent written the decrypt function yet. guess its just the reverse of this.

hth

Prem :)
Re: please help me on the encrypt and decrypt [message #371441 is a reply to message #371433] Thu, 19 October 2000 09:33 Go to previous messageGo to next message
Prabhakar Allathur
Messages: 10
Registered: October 2000
Junior Member
Hi Prem,
It works. Thankyou very much. You have been very helpfull to me.
YES I "owe you a chocolate treat for this"
Thanks again
Prabhakar Allathur
Boston
pallathur@yohoo.com
Re: please help me on the encrypt and decrypt [message #371927 is a reply to message #371433] Thu, 21 December 2000 15:23 Go to previous message
Melissa
Messages: 65
Registered: January 2000
Member
Thanks for posting this code. I have one question: there are 2 flavors of desencrypt/desdecrypt procedures (1) one that accepts strings and (2) one that accepts data of type RAW. I noticed in your code you are accepting string, but then converting it to RAW, and then calling the RAW flavor of the procedure. I am curious why did you not call the STRING flavor of these functions. Is it because you are concerned that after encryption your input string could become binary? This question is not only out of curiosity, because I wrote my version of this code, that deals only with strings, and the output is not always reliable. Namely, sometimes after decryption the result does not look like the original input string (it looks more like some binary data). Sorry thisturned out to be a long question, but any reply would be appreciated.
Previous Topic: Re: Oracle error message
Next Topic: Sending Email from Database through PL/SQL
Goto Forum:
  


Current Time: Thu May 16 23:06:42 CDT 2024