오라클 8.1.6부터 DBMS_OBFUSCATION_TOOLKIT라는 PL/SQL패키지가 제공된다. 이 패키지는 암호화/복호화를 수행하는 2개의 DES프로시저를 가지고 있다. 주의할 점은 8byte의 배수로 이루어져만 암호화가 가능하다는 지랄같은(--;) 제약이 있다.
 
  예를 들어 설명드리겠습니다.
  SQL> connect kang/xxxxxx 연결되었습니다.
  SQL> !cat test.sql DECLARE     input_string     VARCHAR2(8) := 'mustbe8s';     raw_input        RAW(128)    := UTL_RAW.CAST_TO_RAW(input_string);     key_string       VARCHAR2(8) := 'myunggyu';     raw_key          RAW(128)    := UTL_RAW.CAST_TO_RAW(key_string);     encrypted_raw    RAW(2048);     encrypted_string VARCHAR2(2048);     decrypted_raw    RAW(2048);     decrypted_string VARCHAR2(2048);
  BEGIN          dbms_output.put_line('> input string : ' || input_string);          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);          if input_string = decrypted_string THEN         dbms_output.put_line('> String DES Encyption and Decryption successful');     END if; END; /
  SQL> set serveroutput on SQL> @test > input string : mustbe8s > encrypted hex value : BBD15581726E4A72 > decrypted string output : mustbe8s > String DES Encyption and Decryption successful
  PL/SQL procedure successfully completed.
  SQL> 
  |    This article comes from dbakorea.pe.kr (Leave this line as is) 
  |