DECLARE --=========================================================================== -- Copywright 2007, chet west --============================================================================= -- DESCRIPTION -- Example on how to encrypt data elements --============================================================================= -- MODIFICATION HISTORY -- Person Date Comments -- --------- ---------- -------------------------------------------- -- Chet 2007 Initial Creation --============================================================================= -- input_string VARCHAR2 ( 16 ) := 'tigertigertigert'; input_string CHAR ( 16 ) := '123456789'; key_string VARCHAR2 ( 16 ) := '0racle9i0racle9i'; encrypted_string VARCHAR2 ( 2048 ); decrypted_string VARCHAR2 ( 2048 ); error_in_input_buffer_length EXCEPTION; PRAGMA EXCEPTION_INIT ( error_in_input_buffer_length, -28232 ); INPUT_BUFFER_LENGTH_ERR_MSG VARCHAR2 ( 100 ) := '*** DES INPUT BUFFER NOT A MULTIPLE OF 8 BYTES ***'; -- 1. Test string data encryption and decryption -- The interface for encrypting raw data is similar. BEGIN Dbms_output.put_line ( '> ========= BEGIN TEST =========' ); Dbms_output.put_line ( '> Input String :' || input_string ); Dbms_obfuscation_toolkit.DES3Encrypt ( input_string => input_string ,key_string => key_string ,encrypted_string => encrypted_string ); Dbms_output.put_line ( '> encrypted string : ' || encrypted_string ); Dbms_obfuscation_toolkit.DES3Decrypt ( input_string => encrypted_string ,key_string => key_string ,decrypted_string => decrypted_string ); Dbms_output.put_line ( '> Decrypted output : ' || decrypted_string ); Dbms_output.put_line ( '> ' ); IF input_string = decrypted_string THEN Dbms_output.put_line ( '> DES Encryption and Decryption successful' ); END IF; EXCEPTION WHEN error_in_input_buffer_length THEN Dbms_output.put_line ( '> ' || INPUT_BUFFER_LENGTH_ERR_MSG ); END;