Demonstrate DES3 encryption : DBMS_OBFUSCATION_TOOLKIT « System Packages « Oracle PL / SQL

Home
Oracle PL / SQL
1.Aggregate Functions
2.Analytical Functions
3.Char Functions
4.Constraints
5.Conversion Functions
6.Cursor
7.Data Type
8.Date Timezone
9.Hierarchical Query
10.Index
11.Insert Delete Update
12.Large Objects
13.Numeric Math Functions
14.Object Oriented Database
15.PL SQL
16.Regular Expressions
17.Report Column Page
18.Result Set
19.Select Query
20.Sequence
21.SQL Plus
22.Stored Procedure Function
23.Subquery
24.System Packages
25.System Tables Views
26.Table
27.Table Joins
28.Trigger
29.User Previliege
30.View
31.XML
Oracle PL / SQL » System Packages » DBMS_OBFUSCATION_TOOLKIT 




Demonstrate DES3 encryption
  
SQL>
SQL> DECLARE
  2   input_string        VARCHAR2(160:= 'password01';
  3   key_string          VARCHAR2(24);
  4
  5   encrypted_string            VARCHAR2(2048);
  6   decrypted_string            VARCHAR2(2048);
  7     error_in_input_buffer_length EXCEPTION;
  8     PRAGMA EXCEPTION_INIT(error_in_input_buffer_length, -28232);
  9     INPUT_BUFFER_LENGTH_ERR_MSG VARCHAR2(100:= '              ';
 10
 11  BEGIN
 12        input_string := input_string||input_string||input_string||input_string||input_string||input_string||input_string||input_string;
 13        dbms_output.put_line('input string              : ' || input_string);
 14        dbms_obfuscation_toolkit.DES3GETKEY(which=>1, seed_string=>input_string,key=>key_string);
 15        dbms_obfuscation_toolkit.DESENCRYPT(input_string => input_string,key_string => key_string, encrypted_string => encrypted_string );
 16        dbms_output.put_line('encrypted string              : ' ||encrypted_string);
 17        dbms_obfuscation_toolkit.DESDecrypt(input_string => encrypted_string,key_string => key_string, decrypted_string => decrypted_string);
 18        dbms_output.put_line('Decrypted output             : ' ||decrypted_string);
 19        if input_string = decrypted_string THEN
 20           dbms_output.put_line('> DES Encryption and Decryption successful');
 21        END if;
 22     EXCEPTION
 23        WHEN error_in_input_buffer_length THEN dbms_output.put_line('> ' || INPUT_BUFFER_LENGTH_ERR_MSG);
 24     END;
 25
 26  /


PL/SQL procedure successfully completed.

SQL>

   
    
  














Related examples in the same category
1.DBMS_OBFUSCATION_TOOLKIT.des3getkey
2.DBMS_OBFUSCATION_TOOLKIT.des3encrypt
3.DBMS_OBFUSCATION_TOOLKIT.md5 and RAWTOHEX
4.DBMS_OBFUSCATION_TOOLKIT.des3decrypt
5.dbms_obfuscation_toolkit.md5
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.