please help me on the encrypt and decrypt [message #371433] |
Wed, 18 October 2000 15:58 |
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 |
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 #371927 is a reply to message #371433] |
Thu, 21 December 2000 15:23 |
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.
|
|
|