联系:手机/微信(+86 17813235971) QQ(107644445)
作者:惜分飞©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]
1.测试脚本
[oracle@bas ~]$ more pkg_wrap_xff.sql create or replace package pkg_wrap_xff is procedure welcome_in(abc in varchar2); END pkg_wrap_xff; / create or replace package body pkg_wrap_xff is procedure welcome_in(abc in varchar2) as begin dbms_output.put_line('welcome ' || abc); end; END pkg_wrap_xff; /
2.创建并测试包
SQL> @pkg_wrap_xff Package created. Package body created. SQL> set serveroutput on SQL> exec pkg_wrap_xff.welcome_in('xifenfei'); welcome xifenfei PL/SQL procedure successfully completed.
3.查看包内容
SQL> SELECT TEXT FROM dba_source a WHERE a.name='PKG_WRAP_XFF'; TEXT -------------------------------------------------------------- package pkg_wrap_xff is procedure welcome_in(abc in varchar2); END pkg_wrap_xff; package body pkg_wrap_xff is procedure welcome_in(abc in varchar2) as begin dbms_output.put_line('welcome ' || abc); end; END pkg_wrap_xff; 9 rows selected.
4.使用wrap加密
[oracle@bas ~]$ wrap iname=pkg_wrap_xff.sql oname=pkg_wrap_xff.plb PL/SQL Wrapper: Release 10.2.0.1.0- 64bit Production on Tue Apr 03 11:16:52 2012 Copyright (c) 1993, 2004, Oracle. All rights reserved. Processing pkg_wrap_xff.sql to pkg_wrap_xff.plb [oracle@bas ~]$ ll pkg_wrap_xff* -rw-r--r-- 1 oracle oinstall 634 Apr 3 11:16 pkg_wrap_xff.plb -rw-r--r-- 1 oracle oinstall 273 Apr 3 10:58 pkg_wrap_xff.sql [oracle@bas ~]$ more pkg_wrap_xff.plb create or replace package pkg_wrap_xff wrapped a000000 1 abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd 9 53 85 W36vGRTVGRHdbwYRR6PgEKn/uJgwg1zZf9OpynQ2Z/aHUmNhYcN/NpFphdvMis61lthVP41T adMRoYz9KTALorx2DjxUFXms0VvEXmDignlfcQjICNxh0Rmhsp2KsCjohpTO / create or replace package body pkg_wrap_xff wrapped a000000 1 abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd b 96 ce QzGnt9RcmxQyUfes+xtqkeZypV0wg1zwqNPWfI6iCq2Ve93Dd2BzFE8hHRRYZ/LM86Rx2o0E y67F1TM7QgP9WoGRBCUelGt4QvSOmwMecLCe57PVPD5lbxyJLK26scjDS8soGPzcCDysP+WR C0zeZ9lSlyLXqNex8XpUxi7tILux/gNr1FIOWaBRhYqgTZ754pVDNlG4SXE= /
4.测试加密包
SQL> drop package PKG_WRAP_XFF; Package dropped. SQL> @pkg_wrap_xff.plb Package created. Package body created. SQL> set serveroutput on PL/SQL procedure successfully completed. SQL> exec pkg_wrap_xff.welcome_in('www.xifenfei.com'); welcome www.xifenfei.com PL/SQL procedure successfully completed.
查看加密包内容
SQL> set pagesize 1000 SQL> SELECT TEXT FROM dba_source a WHERE a.name='PKG_WRAP_XFF'; TEXT -------------------------------------------------------------------------------- package pkg_wrap_xff wrapped a000000 1 abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd 9 53 85 W36vGRTVGRHdbwYRR6PgEKn/uJgwg1zZf9OpynQ2Z/aHUmNhYcN/NpFphdvMis61lthVP41T adMRoYz9KTALorx2DjxUFXms0VvEXmDignlfcQjICNxh0Rmhsp2KsCjohpTO package body pkg_wrap_xff wrapped a000000 1 abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd abcd b 96 ce QzGnt9RcmxQyUfes+xtqkeZypV0wg1zwqNPWfI6iCq2Ve93Dd2BzFE8hHRRYZ/LM86Rx2o0E y67F1TM7QgP9WoGRBCUelGt4QvSOmwMecLCe57PVPD5lbxyJLK26scjDS8soGPzcCDysP+WR C0zeZ9lSlyLXqNex8XpUxi7tILux/gNr1FIOWaBRhYqgTZ754pVDNlG4SXE=
原则上来说wrap加密是不可逆的过程,所以可以通过使用wrap加密,实现了屏蔽代码的作用,确保了自己的知识产权。其实oracle本身很多的系统包也是通过这种方法进行加密处理,以保护oracle的产权。
wrap加密原理
Oracle加密的原理就是先对源码进行lz压缩lzstr,然后对压缩数据进行SHA-1运算得到40位的加密串shstr,然后将加密串与压缩串拼接得到shstr+lzstr,然后对拼接后的字符串进行Oracle双字符转换(转换表)。最后将转换后的字符串进行base64编码,最终得到wrap的加密串。
Great! 正在找这方面的资料,谢谢!