drop table emp;

create table emp(
EMPNO number primary key,
FIRSTNAME              VARCHAR2(30),
SURNAME              VARCHAR2(30),
PASSWORD              CHAR(32),
PHONE               VARCHAR2(32)
);

create or replace trigger emp_encryptpassword
before insert or update of password on emp
for each row
declare
  
        b_in  raw(16) := UTL_RAW.CAST_TO_RAW(substr(:new.password, 1, 16));
        b_key raw(8)  := UTL_RAW.CAST_TO_RAW('EeTe32!!');
        b_out raw(32); 

begin

        dbms_obfuscation_toolkit.DESEncrypt(input =>b_in, key =>b_key, 
encrypted_data =>b_out);
        :new.password :=rawtohex(b_out); 

  
end;
/   

insert into emp values(1,'BOB','SCOTT','Tiger',NULL);


Hi,
Play with that. Add error checking and decrypt with a function or encrypt the
given password and compare the protected strings.


oli
-- 
Oliver Artelt
Oracle Certified DBA

cubeoffice GmbH & Co.KG # jordanstrasse 7 # 39112 magdeburg
telefon: +49 (0)391 6 11 28 10 # telefax: +49 (0)391 6 11 28 19
email: [EMAIL PROTECTED] # web: http://www.cubeoffice.de



[EMAIL PROTECTED] wrote
> Hi Gurus !
>
> Is there any standard method to encrypt data? We are making an application
> that uses application-level privilege system, so we should store passwords
> for users. Of course we want to store encrypted passwords, but we don't
> know if is there an existing way for this or try develop own encryption.
> What do you suggest?
>
> Thanks in advance
> Gyula
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Oliver Artelt
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to