Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Hiding PL/SQL Source code
Wrap will encrypt your code but the fact that they exist is still visible.
If you wish to add another level of complexity ... put your code inside of a package body as local code (not declare in the header) and then wrap it.
Daniel Morgan
Paul Quenneville wrote:
> Wrap Utility
> This appendix shows you how to run the Wrap Utility, a stand-alone
> programming utility that encrypts PL/SQL source code. You can use the Wrap
> Utility to deliver PL/SQL applications without exposing your source code.
>
> Major Topics
> Advantages of Wrapping
> Running the Wrap Utility
> Guidelines
> Advantages of Wrapping
> By hiding application internals, the Wrap Utility prevents
>
> a.. misuse of your application by other developers
>
> b.. exposure of your algorithms to business competitors
>
> Wrapped code is as portable as source code. The PL/SQL compiler recognizes
> and loads wrapped compilation units automatically. Other advantages include
>
> a.. platform independence--you need not deliver multiple versions of the
> same compilation unit
>
> b.. dynamic loading--users need not shut down and re-link to add a new
> feature
>
> c.. dynamic binding--external references are resolved at load time
>
> d.. strict dependency checking--invalidated program units are recompiled
> automatically
>
> e.. normal importing and exporting--the Import/Export utility accepts
> wrapped files
>
> Running the Wrap Utility
> To run the Wrap Utility, enter the wrap command at your operating system
> prompt using the following syntax:
>
> wrap iname=input_file [oname=output_file]
>
> Leave no space around the equal signs because spaces delimit individual
> arguments.
>
> The wrap command requires only one argument, which is
>
> iname=input_file
>
> where input_file is the name of the Wrap Utility input file. You need not
> specify the file extension because it defaults to sql. For example, the
> following commands are equivalent:
>
> wrap iname=/mydir/myfile
> wrap iname=/mydir/myfile.sql
>
> However, you can specify a different file extension as the following example
> shows:
>
> wrap iname=/mydir/myfile.src
>
> Optionally, the wrap command takes a second argument, which is
>
> oname=output_file
>
> where output_file is the name of the Wrap Utility output file. You need not
> specify the output file because its name defaults to that of the input file
> and its extension defaults to plb (PL/SQL binary). For example, the
> following commands are equivalent:
>
> wrap iname=/mydir/myfile
> wrap iname=/mydir/myfile.sql oname=/mydir/myfile.plb
>
> However, you can use the option oname to specify a different file name and
> extension, as the following example shows:
>
> wrap iname=/mydir/myfile oname=/yourdir/yourfile.obj
> Input and Output Files
> The input file can contain any combination of SQL statements. However, the
> Wrap Utility encrypts only the following CREATE statements, which define
> subprograms, packages, or object types:
>
> CREATE [OR REPLACE] FUNCTION function_name
> CREATE [OR REPLACE] PROCEDURE procedure_name
> CREATE [OR REPLACE] PACKAGE package_name
> CREATE [OR REPLACE] PACKAGE BODY package_name
> CREATE [OR REPLACE] TYPE type_name ... OBJECT
> CREATE [OR REPLACE] TYPE BODY type_name
>
> All other SQL statements are passed intact to the output file. Comment lines
> are deleted unless they appear inside a subprogram, package, or object type.
>
> When encrypted, a subprogram, package, or object type has the form
>
> <header> wrapped <body>
>
> where header begins with the reserved word CREATE and ends with the name of
> the subprogram, package, or object type, and body is an intermediate form of
> object code. The word wrapped tells the PL/SQL compiler that the subprogram,
> package, or object type was encrypted by the Wrap Utility.
>
> The header can contain comments. For example, the Wrap Utility converts
>
> CREATE PACKAGE
> -- Author: J. Hollings
> -- Date: 10/15/99
> banking AS
> minimum_balance CONSTANT REAL := 25.00;
> insufficient_funds EXCEPTION;
> END banking;
>
> into
>
> CREATE PACKAGE
> -- Author: J. Hollings
> -- Date: 10/15/99
> banking wrapped
> 0
> abcd ...
>
> Generally, the output file is much larger than the input file.
>
> Error Handling
> If your input file contains syntax errors, the Wrap Utility detects and
> reports them. However, the Wrap Utility cannot detect semantic errors
> because it does not resolve external references. For example, it does not
> report the following error (table or view does not exist):
>
> CREATE PROCEDURE raise_salary (emp_id INTEGER, amount NUMBER) AS
> BEGIN
> UPDATE amp -- should be emp
> SET sal = sal + amount WHERE empno = emp_id;
> END;
>
> The PL/SQL compiler resolves external references. So, semantic errors are
> reported when the Wrap Utility output file (.plb file) is compiled.
>
> Version Compatibility
> The Wrap Utility is upward-compatible with Oracle. So, for example, you can
> load files processed by the V8.1.5 Wrap Utility into a V8.1.6 Oracle
> database. However, the Wrap Utility is not downward-compatible with Oracle.
> So, for example, you cannot load files processed by the V8.1.6 Wrap Utility
> into a V8.1.5 Oracle database.
>
> Guidelines
> When wrapping a package or object type, wrap only the body, not the spec.
> That way, other developers see the information they need to use the package
> or type, but they do not see its implementation.
>
> Like all encrypted files, wrapped files cannot be edited. To revise a
> wrapped file, you must revise and re-wrap the underlying source code. So, do
> not wrap a subprogram, package, or object type until it is ready for
> shipment to end-users.
>
> "ales voderka" <ales.voderka_at_e-bs.cz> wrote in message
> news:a5vovq$f8f$1_at_news.eunet.cz...
> > Hello,
> > I would like to know if there is any way how to hide PL/SQL Source code
> from
> > being available in database. The problem is that we have an application
> > which is written in PL/SQL packages. Now we will have to install by our
> > customers which will have administration access to the database. We would
> > like to have our app in the database but we don't want to let them see our
> > code. We use oracle 8.1.7.
> >
> > Thanks in advance
> > Ales Voderka
> >
> >
Received on Mon Mar 04 2002 - 12:29:29 CST
![]() |
![]() |