Home » RDBMS Server » Security » PassWord encryption and decryption
PassWord encryption and decryption [message #18656] Sat, 09 February 2002 03:06 Go to next message
Abdullah Gilani
Messages: 18
Registered: October 2001
Junior Member
hi all Oracle8i Rel-2 and onwards users,

for password encryption and decryption Oracle 8i Provide built-in Package "DBMS_OBFUSCATION_TOOLKIT"
you may use DBMS_OBFUSCATION_TOOLKIT package.
DBMS_OBFUSCATION_TOOLKIT works only from Oracle realease 8.1.6 onwards

OR
you may use following Procedure....input 8 or multiple of 8 (6,16,24......)...
following procedure encrypted into hex value...like 'agilani ' where agilani plus one space is the password...try and enjoy

DECLARE
input_string VARCHAR2(16) := 'agilani ';
key_string VARCHAR2(8) := 'scottsc ';
encrypted_string VARCHAR2(2048);
decrypted_string VARCHAR2(2048);
begin
dbms_obfuscation_toolkit.DESEncrypt(
input_string => input_string,
key_string => key_string,
encrypted_string => encrypted_string );
dbms_output.put_line('> encrypted hex value : ' ||
rawtohex(UTL_RAW.CAST_TO_RAW(encrypted_string)));
dbms_obfuscation_toolkit.DESDecrypt(
input_string => encrypted_string,
key_string => key_string,
decrypted_string => decrypted_string );
dbms_output.put_line('> decrypted string output : ' ||
decrypted_string);
end;

Thanks & Regards

Abdullah Gilani
Email: syedgilani@hotmail.com
Re: PassWord encryption and decryption [message #18657 is a reply to message #18656] Sat, 09 February 2002 03:55 Go to previous messageGo to next message
Rick
Messages: 49
Registered: March 2000
Member
We are in Oracle Application 11.0.3 and Oracle 8.06. We would like to create fnd users automatically with default 'WELCOME' as password. Is it possible to do that.
Re: PassWord encryption and decryption [message #18673 is a reply to message #18657] Sun, 10 February 2002 20:11 Go to previous messageGo to next message
Abdullah Gilani
Messages: 18
Registered: October 2001
Junior Member
hi Rick,
if you would like to set default password you may handle in Programming,
or
if you would like to insert automatically with default 'WELCOME' as password.....please follow the following example,

create table LOGIN (Userid varchar2(20), Password varchar2(16));

Alter table Login modify password varchar2(16) default 'WELCOME';

insert into Login (userid) values ('gilani');

select * from Login;

Regards,

Abdullah Gilani,
Email: syedgilani@hotmail.com
Re: PassWord encryption and decryption [message #558919 is a reply to message #18673] Wed, 27 June 2012 06:01 Go to previous messageGo to next message
parthiv_t
Messages: 15
Registered: July 2011
Location: ahmedabad
Junior Member
Hello

If I assign values Input_string more than or less than 8 character word

it will Shows me error.


ORA-28232: invalid input length for obfuscation toolkit
ORA-06512: at "SYS.DBMS_OBFUSCATION_TOOLKIT_FFI", line 21
ORA-06512: at "SYS.DBMS_OBFUSCATION_TOOLKIT



If I want to use this pl/sql block in my application, not necessarily user input their password which contain 8 characters only.

So can you please help me?

Thanks and regards
Parthiv


[Updated on: Wed, 27 June 2012 06:05]

Report message to a moderator

Re: PassWord encryption and decryption [message #558920 is a reply to message #558919] Wed, 27 June 2012 06:08 Go to previous messageGo to next message
Michel Cadot
Messages: 58521
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Pad the string up to a multiple of 8 bytes.
And in the current versions no more use DBMS_OBFUSCATION_TOOLKIT but DBMS_CRYPTO.

Regards
Michel
Re: PassWord encryption and decryption [message #558921 is a reply to message #558920] Wed, 27 June 2012 06:11 Go to previous messageGo to next message
parthiv_t
Messages: 15
Registered: July 2011
Location: ahmedabad
Junior Member
Thanks Smile
Re: PassWord encryption and decryption [message #565244 is a reply to message #18656] Sat, 01 September 2012 04:51 Go to previous messageGo to next message
swapnil_naik
Messages: 268
Registered: December 2009
Location: Mumbai
Senior Member

CREATE OR REPLACE FUNCTION SLB.decrypt_pwd (npwd VARCHAR2) RETURN VARCHAR2 IS
dpwd VARCHAR2(200);
dpwd1 VARCHAR2(200);
i INTEGER;
j INTEGER;
chr_dpwd VARCHAR2(100);
l_dpwd1 NUMBER;
echar VARCHAR2(200);
BEGIN
dpwd1:=LTRIM(npwd);
l_dpwd1:=LENGTH(dpwd1);
IF l_dpwd1 >= 1
THEN
l_dpwd1:=l_dpwd1/2;
j:=1;
FOR i IN 1..l_dpwd1 LOOP
echar:=(SUBSTR(dpwd1,j,1));
SELECT CHR(ASCII(echar)-79)INTO chr_dpwd FROM dual;
dpwd:=dpwd||chr_dpwd;
chr_dpwd:=NULL;
j:=j+2;
END LOOP;
END IF;
RETURN dpwd;
END decrypt_pwd;
/



CREATE OR REPLACE FUNCTION SLB.encrypt_pwd (pwd VARCHAR2) RETURN VARCHAR2 IS
npwd VARCHAR2(200);
pwd1 VARCHAR2(200);
l_pwd1 NUMBER;
i NUMBER;
chr_pwd VARCHAR2(200);
echar VARCHAR2(200);
BEGIN
pwd1 :=LTRIM(pwd);
l_pwd1:=LENGTH(pwd1);
IF l_pwd1 >=1
THEN
FOR i IN 1..l_pwd1 LOOP
echar := SUBSTR(pwd1,i,1);
SELECT CHR(ASCII(echar)+79)||CHR(ASCII(i)+10) INTO chr_pwd FROM dual;
npwd := npwd||chr_pwd;
chr_pwd:=NULL;
END LOOP;
END IF;
RETURN npwd;
END encrypt_pwd;
/


Its work successfully
Re: PassWord encryption and decryption [message #565246 is a reply to message #565244] Sat, 01 September 2012 05:43 Go to previous messageGo to next message
John Watson
Messages: 4374
Registered: January 2010
Location: Global Village
Senior Member
Are you sure about this?
orcl>
orcl>
orcl> select encrypt_pwd('password') from dual;

ENCRYPT_PWD('PASSWORD')
------------------------------------------------------------
;<=>?@AB

orcl> select encrypt_pwd('another1') from dual;

ENCRYPT_PWD('ANOTHER1')
------------------------------------------------------------
;<=>?@AB

orcl> select decrypt_pwd(';<=>?@AB') from dual;
select decrypt_pwd(';<=>?@AB') from dual
       *
ERROR at line 1:
ORA-01426: numeric overflow
ORA-06512: at "SCOTT.DECRYPT_PWD", line 18


orcl>
Re: PassWord encryption and decryption [message #565250 is a reply to message #565246] Sat, 01 September 2012 09:27 Go to previous message
Michel Cadot
Messages: 58521
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Laughing

Previous Topic: privileges for stats
Next Topic: Queries run by Database Auditors
Goto Forum:
  


Current Time: Wed Jul 23 22:01:26 CDT 2014

Total time taken to generate the page: 0.10588 seconds