Home » RDBMS Server » Security » password decryption........
password decryption........ [message #43492] Tue, 29 July 2003 05:34 Go to next message
neeraj
Messages: 16
Registered: October 2001
Junior Member
I am trying to save the password in incryped form and later view in decryot form...

while incrypting it's fine but that password is not decrypted while i view again the same...

here is the plsql i used...
************************
CREATE OR REPLACE PACKAGE PASSWORD AS
function encrypt(i_password varchar2) return varchar2;
function decrypt(i_password varchar2) return varchar2;
END PASSWORD;
/
show errors

CREATE OR REPLACE PACKAGE BODY PASSWORD AS

c_encrypt_key varchar2(8) := 'key45678';

function encrypt (i_password varchar2) return varchar2 is
v_encrypted_val varchar2(38);
v_data varchar2(38);
begin

eight
v_data := RPAD(i_password,(TRUNC(LENGTH(i_password)/8)+1)*8,CHR(0));

DBMS_OBFUSCATION_TOOLKIT.DESENCRYPT(
input_string => v_data,
key_string => c_encrypt_key,
encrypted_string => v_encrypted_val);
return v_encrypted_val;
end encrypt;

function decrypt (i_password varchar2) return varchar2 is
v_decrypted_val varchar2(38);
begin
DBMS_OBFUSCATION_TOOLKIT.DESDECRYPT(
input_string => i_password,
key_string => c_encrypt_key,
decrypted_string => v_decrypted_val);
return v_decrypted_val;
end decrypt;

end PASSWORD;
/
show errors

select password.encrypt('PASSWORD1') from dual;
select password.decrypt(app_password.encrypt('PASSWORD1')) from dual;
select password.encrypt('PSW2') from dual;
select password.decrypt(app_password.encrypt('PSW2')) from dual;
Re: password decryption........ [message #43496 is a reply to message #43492] Tue, 29 July 2003 12:44 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Why are you encrypting the password using a different package (app_password)?

Here are the (correct) results on 9iR2 if you use the same package (password):

sql>select password.encrypt('PASSWORD1') from dual;
 
PASSWORD.ENCRYPT('PASSWORD1')
------------------------------------------------------------------------------
kWnZ dq%)
 
1 row selected.
 
sql>select password.decrypt(password.encrypt('PASSWORD1')) from dual;
 
PASSWORD.DECRYPT(PASSWORD.ENCRYPT('PASSWORD1'))
------------------------------------------------------------------------------
PASSWORD1
 
1 row selected.
 
sql>select password.encrypt('PSW2') from dual;
 
PASSWORD.ENCRYPT('PSW2')
------------------------------------------------------------------------------
fwղ
 
1 row selected.
 
sql>select password.decrypt(password.encrypt('PSW2')) from dual;
 
PASSWORD.DECRYPT(PASSWORD.ENCRYPT('PSW2'))
------------------------------------------------------------------------------
PSW2
 
1 row selected.
Previous Topic: creating a user but not alter his password....?
Next Topic: Security: Roles
Goto Forum:
  


Current Time: Sat Aug 08 19:24:33 CDT 2020