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 osama/osama;
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 .

[oracle@localhost ~]$ 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 :

[oracle@localhost ~]$ 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 

[oracle@localhost ~]$ 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 :

[oracle@localhost ~]$ sqlplus osama/osama

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.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.