oracle提供wrap工具对oracle源代码进行加密,加密后只可见到源代码头部;对于procedure来说就是as之前的部分.
wrap使用步骤.
1.建立需加密的程序脚本.以txt文件的形式放到某目录下.
c盘根目录下建立to_wrap.sql文件.
内容为
CREATE OR REPLACE FUNCTION func_test_wrap RETURN VARCHAR2 AS
BEGIN
RETURN 'A,你好';
END;
注意:不要在程序结尾附加 / .
2.设置nls_lang以支持中文
C:/>set nls_lang=CHINESE_CHINA.ZHS16GBK
3.使用wrap加密
C:/>wrap iname=c:/to_wrap.sql
PL/SQL Wrapper: Release 10.2.0.1.0- Production on Thu Dec 23 15:46:18 2010
Copyright (c) 1993, 2004, Oracle. All rights reserved.
Processing c:/to_wrap.sql to to_wrap.plb
4.进入sqlplus执行加密脚本
C:/Documents and Settings/Administrator>sqlplus scott/wellhope
SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 12月 23 15:47:00 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> @ c:/to_wrap.plb
函数已创建。
SQL>
5.测试.
SQL> select func_test_wrap from dual;
FUNC_TEST_WRAP
--------------------------------------------------------------------------------
A,你好
SQL>
6.查看函数是否加密
CREATE OR REPLACE FUNCTION func_test_wrap wrapped
a000000
354
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
8
4a 81
6CqTgzEkPzbX5sNGNWU+qTl1Nvgwg8eZgcfLCNL+XlrV1wxKlqFi0fSWlvJWaefAsr2ym17n
x3TAM7h0ZQm4dIvAwDL+0oYJqaEm2vx2QjQeS0UqnApPbSofHaZ59G9S