Obfuscation encodes the body of the DDL statements for
database objects such as routines, triggers, views, and PL/SQL packages.
Obfuscating your code helps protect your intellectual property because
users cannot read the code, but DB2® for Linux, UNIX, and Windows can
still understand it.
The DBMS_DDL module provides two routines for obfuscating your
routines, triggers, views, or your PL/SQL packages:
- WRAP function
- Takes a routine, trigger, PL/SQL package, or PL/SQL package body
definition as an argument and produces a string containing the initial
header followed by an obfuscated version of the rest of the statement.
For example, input like:
CREATE PROCEDURE P(a INT)
BEGIN
INSERT INTO T1 VALUES (a);
END
using the DBMS_DDL.WRAP function might result in:CREATE PROCEDURE P(a INT) WRAPPED SQL09072
aBcDefg12AbcasHGJG6JKHhgkjFGHHkkkljljk878979HJHui99
The
obfuscated portion of the DDL statement contains codepage invariant
characters, ensuring that it is valid for any codepage.
- CREATE_WRAPPED procedure
- Takes the same input as the WRAP function described previously,
but instead of returning the obfuscated text, an object is created
in the database. Internally the object is not obfuscated so that it
can be processed by the compiler, but in catalog views like SYSCAT.ROUTINES
or SYSCAT.TRIGGERS the content of the TEXT column is obfuscated.
An obfuscated statement can be used in CLP scripts and can be submitted
as dynamic SQL using other client interfaces.
Obfuscation is available for the following statements:
- db2look by using the -wrap option
- CREATE FUNCTION
- CREATE PACKAGE
- CREATE PACKAGE BODY
- CREATE PROCEDURE
- CREATE TRIGGER
- CREATE VIEW
- ALTER MODULE
The
db2look tool obfuscates all the preceding
statements when the
-wrap option is used.