In this article, encrption and decryption of a sample code in plsql is shown.
Below code is tested in 11.5.10
declare
dec_str varchar2(2000);
Ret_in_string varchar2(2000);
in_str varchar2(2000):='select dummy from dual';
piv_key varchar2(2000):='8bitekey';
a_var varchar2(100);
begin
if mod(length(in_str),8) != 0 then
in_str := rpad(in_str,length(in_str)+8-mod(length(in_str),8),chr(0));
dbms_output.put_line('Input_string->:'in_str);
end if;
dec_str:=dbms_obfuscation_toolkit.desencrypt(input_string=>in_str, key_string=>piv_key);
--below command for decrypting the same.
dbms_output.put_line('encrypt_string:->'dec_str);
Ret_in_string := dbms_obfuscation_toolkit.desdecrypt(input_string=>dec_str, key_string=>piv_key); dbms_output.put_line('decrypt_string:->'Ret_in_string);
end;
Below code is tested in 11.5.10
declare
dec_str varchar2(2000);
Ret_in_string varchar2(2000);
in_str varchar2(2000):='select dummy from dual';
piv_key varchar2(2000):='8bitekey';
a_var varchar2(100);
begin
if mod(length(in_str),8) != 0 then
in_str := rpad(in_str,length(in_str)+8-mod(length(in_str),8),chr(0));
dbms_output.put_line('Input_string->:'in_str);
end if;
dec_str:=dbms_obfuscation_toolkit.desencrypt(input_string=>in_str, key_string=>piv_key);
--below command for decrypting the same.
dbms_output.put_line('encrypt_string:->'dec_str);
Ret_in_string := dbms_obfuscation_toolkit.desdecrypt(input_string=>dec_str, key_string=>piv_key); dbms_output.put_line('decrypt_string:->'Ret_in_string);
end;
Post a Comment