Friday, 10 July 2015

Encrypt Your PL/SQL Code Using Wrap Command


Today I will make demonstration how to hide your code , Function , Procedure and anything Related to PL/SQL Code , to do this you have to know wrap utility in oracle .

Step #1:

You Have to Write Sample Code to Make test on it .

Sample Code :

    SQL> CREATE OR REPLACE PROCEDURE testproc
    IS
    BEGIN
       DBMS_OUTPUT.PUT_LINE('Wrap Me!');
     END;
    /
    Procedure created.


Ensure Procedure Run Successfully :

    SQL> exec testproc

    PL/SQL procedure successfully completed.


The above Steps Just to make sure our Procedure will run suceesfully without any error , now i will delete it again and start using wrap to encrypt.

    SQL> conn test/test;
    Connected.
    SQL>
    SQL> drop procedure testproc ;

    Procedure dropped.

Step #2:

Using Wrap to Create plb File .

-Save Above Procedure in File Called TestProc.sql under home>>oracle .

    C:\Documents and Settings\Ramtech> wrap iname=Testproc.sql

    PL/SQL Wrapper: Release 10.2.0.5.0- Production on Mon Dec 03 22:42:14 2012

    Copyright (c) 1993, 2004, Oracle.  All rights reserved.

    Processing Testproc.sql to Testproc.plb

 OR

If i want to get my procedure script wrapped and no one can read my file :


    C:\Documents and Settings\Ramtech> wrap iname=Testproc.sql oname=wrapped.sql

    PL/SQL Wrapper: Release 10.2.0.5.0- Production on Mon Dec 03 22:46:12 2012

    Copyright (c) 1993, 2004, Oracle.  All rights reserved.

    Processing Testproc.sql to wrapped.sql


Open Wrapped.sql

    C:\Documents and Settings\Ramtech> more wrapped.sql
    CREATE OR REPLACE PROCEDURE testproc wrapped
    a000000
    1
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    abcd
    7
    49 85
    SOwY8JEJe1MROnuBTksxRTO9iJ4wg5nnm7+fMr2ywFwWoWLRPhaXroubdIvAwDL+0oYJjwlp
    uFKbskr+KLK957KzHQYwLK4k6rKBpVHb4USaw+kyLvYOxeokH/Y5pkT0tnU=

    /
    

Step #3:

Now I want to create procedure in my database :

    C:\Documents and Settings\Ramtech> sqlplus test/test

    SQL*Plus: Release 10.2.0.5.0 - Production on Mon Dec 3 22:48:03 2012

    Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> @Testproc.plb

    Procedure created.

    SQL>
    SQL>
    SQL> exec Testproc

    PL/SQL procedure successfully completed.


Thanks.
NJ

No comments:

Post a Comment