Wednesday, August 3, 2011

Oracle Wrapping / Obfuscating






The advantages of obfuscating, or hiding, the source code of PL/SQL units with the wrap utility or wrap subprograms of the DBMS_DDL package are:
  • It is difficult for other developers to misuse your application, or business competitors to see your algorithms.
  • Your source code is not visible through the USER_SOURCEALL_SOURCE, or DBA_SOURCE data dictionary views.
  • SQL*Plus can process the obfuscated source files.
  • The Import and Export utilities accept wrapped files. You can back up or move wrapped procedures.
Untuk Hide Script Dari Orang Lain @ Kedekut Sikit @ Kasi Secure Sikit, Anda Hanya Perlu Wrappingkan Coding Anda.


sila ikut sebijik contoh dibawah :


coding asal :
=============================================
CREATE OR REPLACE PACKAGE HAIRE.PKG_1
AS
   FUNCTION encrypt (p_plainText VARCHAR2) RETURN RAW DETERMINISTIC;
END;
/


CREATE OR REPLACE PACKAGE BODY HAIRE.PKG_1
AS
     encryption_key    PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_DES; 
     encryption_type     RAW (32) := UTL_RAW.cast_to_raw('KeySulitTakBolehShare10012');
     


     FUNCTION encrypt (p_plainText VARCHAR2) RETURN RAW DETERMINISTIC
     IS
        encrypted_raw      RAW (2000);
     BEGIN
        encrypted_raw := DBMS_CRYPTO.ENCRYPT
        (
           src => UTL_RAW.CAST_TO_RAW (p_plainText),
           typ => encryption_key,
           key => encryption_type
        );
       RETURN encrypted_raw;
     END encrypt;
END;
/


script untuk encrypt :
=============================================
 DECLARE
  v_procedure VARCHAR2(32767);
  BEGIN
   v_procedure :=  'CREATE OR REPLACE PACKAGE BODY HAIRE.PKG_1 AS      
     encryption_key    PLS_INTEGER := DBMS_CRYPTO.ENCRYPT_DES; 
     encryption_type     RAW (32) := UTL_RAW.cast_to_raw(''KeySulitTakBolehShare10012''); 
     FUNCTION encrypt (p_plainText VARCHAR2) RETURN RAW DETERMINISTIC     IS        encrypted_raw      RAW (2000);     BEGIN
        encrypted_raw := DBMS_CRYPTO.ENCRYPT  ( src => UTL_RAW.CAST_TO_RAW (p_plainText),  typ => encryption_key,  key => encryption_type  );  RETURN encrypted_raw;
     END encrypt;'
    || 'END;';


    SYS.DBMS_DDL.CREATE_WRAPPED(v_procedure);

  END;
  /


coding yang di encrypt encrypt :
=============================================
CREATE OR REPLACE PACKAGE BODY HAIRE.PKG_1 wrapped 
a000000
1f
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
b
220 17d
wzuxYssdavttxYHqXzhV1MDQgswEF8wg3nMr9zbyi+BNA9as/xHmM3ux5NLTYvQIt8Z8+NyaDtluG
1861gIhWSOVDZ0DGpRkTB5TALwDmeCZEIrwZNTBaHsifISVip9KRFa odmiUbGpP+1R
4B+4DSPlHnsnm/xLsYtLtXAkAKnhNLe4P2gTMoZTasaNB3jqFIeM09m/50NlaoGkQ8eMP14eUoP
ATTwMhJOsl3qGAo=
/

0 comments:

Post a Comment

Say whut you want, but be responsible on whut you said...