首页 » ORACLE 9i-23ai » oracle wrap 工具加密sql源代码

oracle wrap 工具加密sql源代码

oracle 提供了wrap 工具加密你的sql 源代码,现在很编程都把业务逻辑写进了数据库,一些核心的代码不想被公开,比如使用传统的方法创建procedure,源代码是明文保存在oracle数据字典里面的,很容易查看,在Oracle中,推出了Wrap技术,既可以实现代码的加密,使用户不能够直接获取到程序代码的DDL语句,同时不会影响到程序代码的执行。在最新的Oracle版本中,提供了两种方式进行Wrap加密:

1       Wrap命令行工具,可以在命令行中实现源代码文件的加密;

2       Dbms_ddl包,其中包括的方法也可以实现在PL/SQL中进行代码的加密;

下面先看wrap 加密码方法

[oracle@orazhang sql]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 – Production on 星期五 6月 3 13:59:17 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

idle> conn anbob/anbob
Connected.

anbob@ORCL> create or replace  procedure p_testwrap
2  is
3  begin
4  dbms_output.put_line(‘This is anbob”s test…’);
5  end;
6  /

Procedure created.

anbob@ORCL> set serveroutput on;
anbob@ORCL> exec p_testwrap;
This is anbob’s test…

PL/SQL procedure successfully completed.

anbob@ORCL> exec dbms_output.put_line(dbms_metadata.get_ddl(‘PROCEDURE’,’P_TESTWRAP’));

CREATE OR REPLACE PROCEDURE “ANBOB”.”P_TESTWRAP”
is
begin
dbms_output.put_line(‘This is anbob”s test…’);
end;

PL/SQL procedure successfully completed.

anbob@ORCL> host
[oracle@orazhang sql]$ vi p_testwrap.sql

[oracle@orazhang sql]$ more p_testwrap.sql
CREATE OR REPLACE PROCEDURE “ANBOB”.”P_TESTWRAP”
is
begin
dbms_output.put_line(‘This is anbob”s test…’);
end;

[oracle@orazhang sql]$ wrap iname=p_testwrap.sql oname=p_testwrap.pld

PL/SQL Wrapper: Release 10.2.0.1.0- Production on 星期五 6月  03 14:20:32 2011

Copyright (c) 1993, 2004, Oracle.  All rights reserved.

Processing p_testwrap.sql to p_testwrap.pld

[oracle@orazhang sql]$ ls
p_testwrap.pld  p_testwrap.sql
[oracle@orazhang sql]$ more p_testwrap.pld
CREATE OR REPLACE PROCEDURE P_TESTWRAP wrapped
a000000
354
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
7
57 9a
oXaZXiDoYmC01ceuoatrRGf9fPgwg5nnm7+fMr2ywFzn4yhSssu9KMB0aY+bdIvAwDL+0obA
UpuySv4osr3nsrMdBjAsriTqsoHIX0fgRMryRwyXrgnqlisWoWLRs+vrXrGgi8CBxy2L4Kam
JA0EeA==

/

exit

anbob@ORCL> @p_testwrap.pld

Procedure created.

anbob@ORCL> exec p_testwrap;
This is anbob’s test…

PL/SQL procedure successfully completed.

anbob@ORCL> exec dbms_output.put_line(dbms_metadata.get_ddl(‘PROCEDURE’,’P_TESTWRAP’));

CREATE OR REPLACE PROCEDURE “ANBOB”.”P_TESTWRAP”
wrapped
a000000
354
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
7
57
9a
oXaZXiDoYmC01ceuoatrRGf9fPgwg5nnm7+fMr2ywFzn4yhSssu9KMB0aY+bdIvAwDL+0obA
UpuySv4osr3nsrMdBjAsriTqsoHIX0fgRMryRwyXrgnqlisWoWLRs+vrXrGgi8CBxy2L4Kam
J
A0EeA==

PL/SQL procedure successfully completed.

anbob@ORCL>

################下面使用另一个方法 dbms_ddl ##############

sys@ORCL> exec dbms_ddl.create_wrapped(‘create or replace  procedure p_testwrap is begin dbms_output.put_line(”This is anbob ”” test…”); end;’);

PL/SQL procedure successfully completed.

sys@ORCL> exec p_testwrap;
This is anbob ‘ test…

PL/SQL procedure successfully completed.

sys@ORCL> exec dbms_output.put_line(dbms_metadata.get_ddl(‘PROCEDURE’,’P_TESTWRAP’));

CREATE OR REPLACE PROCEDURE “SYS”.”P_TESTWRAP” wrapped
a000000
354
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
7
55
96
04x99q2ywDxwGFIRjwDxK5zFNdQwg5nnm7+fMr2ywFzn4yhSssu9KMB0aaV0K7jAMv7SXrhS
m7JK/iiyveeysx0GMCyuJOqygchfR+BEyvJHDJeuCWnq6hahYtGz6+tesaAruIHHLcmmpu8T
B
NM=

PL/SQL procedure successfully completed.

sys@ORCL>

打赏

对不起,这篇文章暂时关闭评论。