EDB*Wrap v13
The EDB*Wrap utility protects proprietary source code and programs (functions, stored procedures, triggers, and packages) from unauthorized scrutiny. The EDB*Wrap program translates a file that contains SPL or PL/pgSQL source code (the plaintext) into a file that contains the same code in a form that is nearly impossible to read. Once you have the obfuscated form of the code, you can send that code to the PostgreSQL server and the server will store those programs in obfuscated form. While EDB*Wrap does obscure code, table definitions are still exposed.
Everything you wrap is stored in obfuscated form. If you wrap an entire package, the package body source, as well as the prototypes contained in the package header and the functions and procedures contained in the package body are stored in obfuscated form.
If you wrap a CREATE PACKAGE
statement, you hide the package API from other developers. You may want to wrap the package body, but not the package header so users can see the package prototypes and other public variables that are defined in the package body. To allow users to see what prototypes the package contains, use EDBWrap to obfuscate only the CREATE PACKAGE BODY
statement in the edbwrap input file, omitting the CREATE PACKAGE
statement. The package header source will be stored plaintext, while the package body source and package functions and procedures will be stored obfuscated.
Once wrapped, source code and programs cannot be unwrapped or debugged. Reverse engineering is possible, but would be very difficult.
The entire source file is wrapped into one unit. Any psql
meta-commands included in the wrapped file will not be recognized when the file is executed; executing an obfuscated file that contains a psql meta-command will cause a syntax error. edbwrap
does not validate SQL source code -if the plaintext form contains a syntax error, edbwrap
will not complain. Instead, the server will report an error and abort the entire file when you try to execute the obfuscated form.
Using EDB*Wrap to Obfuscate Source Code
EDB*Wrap is a command line utility; it accepts a single input source file, obfuscates the contents and returns a single output file. When you invoke the edbwrap
utility, you must provide the name of the file that contains the source code to obfuscate. You may also specify the name of the file where edbwrap
will write the obfuscated form of the code. edbwrap
offers three different command-line styles. The first style is compatible with Oracle's wrap
utility:
The iname=input_file
argument specifies the name of the input file; if input_file
does not contain an extension, edbwrap
will search for a file named input_file.sql
The oname=output_file
argument (which is optional) specifies the name of the output file; if output_file
does not contain an extension, edbwrap
will append .plb
to the name.
If you do not specify an output file name, edbwrap
writes to a file whose name is derived from the input file name: edbwrap
strips the suffix (typically .sql
) from the input file name and adds .plb
.
edbwrap
offers two other command-line styles that may feel more familiar: