如何解密Oracle Warp加密过程
发布网友
发布时间:2022-04-09 19:46
我来回答
共1个回答
热心网友
时间:2022-04-09 21:15
Oracle加密的原理就是先对源码进行lz压缩lzstr,然后对压缩数据进行SHA-1运算得到40位的加密串shstr,然后将加密串与压缩串拼接得到shstr+lzstr,然后对拼接后的字符串进行Oracle双字符转换(转换表)。最后将转换后的字符串进行base64编码,最终得到wrap的加密串。
The default file extension for input_file is sql. The default nameof output_file is input_file.plb. Therefore, these commands are equivalent:
wrapiname=/mydir/myfile
wrapiname=/mydir/myfile.sql oname=/mydir/myfile.plb
Thisexample specifies a different file extension for input_file and adifferent name for output_file:
wrapiname=/mydir/myfile.src oname=/yourdir/yourfile.out
wrap 的使用步骤如下:
(1)将我们要加密的sql 语句保存到一个sql文本里。
(2)用wrap 进行处理,指定输入的sql,即我们第一步的问题,然后指定输出的路径和文件名,默认扩展名是plb。
(3)执行我们第二部进过wrap 处理的sql,即plb文件,创建我们的对象.
示例1:wrap funcation
--函数
CREATE OR REPLACE FUNCTION F_DAVE (
n int
) RETURN string
IS
BEGIN
IF n = 1 THEN
RETURN 'Dave is DBA!';
ELSIF n = 2 THEN
RETURN 'Dave come from AnQing!';
ELSE
RETURN 'Dave come from HuaiNing!';
END IF;
END;
/
SYS@dave2(db2)> select F_DAVE(4) fromal;
F_DAVE(4)
--------------------------------------------------------------------------------
Dave come from HuaiNing!
BTW: 今天群里有人问我的blog的例子里为啥有安庆,因为我是安庆怀宁人。
[oracle@db2 ~]$ pwd
/home/oracle
[oracle@db2 ~]$ cat dave.sql
CREATE OR REPLACE FUNCTION F_DAVE (
n int
) RETURNstring
IS
BEGIN
IF n = 1 THEN
RETURN 'Dave is DBA!';
ELSIF n = 2 THEN
RETURN 'Dave come from AnQing!';
ELSE
RETURN 'Dave come from HuaiNing!';
END IF;
END;
/
[oracle@db2 ~]$ wrap iname=dave.sql
PL/SQL Wrapper: Release 10.2.0.1.0-Proction on Thu Aug 18 22:59:14 2011
Copyright (c) 1993, 2004, Oracle. All rights reserved.
Processing dave.sql to dave.plb
[oracle@db2 ~]$ ls
bifile.bbd dave.plb dave.sql Desktop log.bbd
[oracle@db2 ~]$ cat dave.plb
CREATE OR REPLACE FUNCTION F_DAVE wrapped
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
8
10d e7
S9NWrpt8q6tkKEMxCcfYJz2aLF4wgxDQLZ4VfC9AkE6OnV4ydypXGhveHcDg8UXy98WIg6xR
crtc/BRdQJjutbna/9+g0LlaSx87/znV+y926S1AeC0IRi/tjPJTyvJereDdk8mftMo8QMjV
fw0xXn0zVagAawwNVhSAiy/JPTMKkrBkC5ruMwQSTe6JQNq7Q2QtJV0hgQou0rYuet4/gJ5B
wAj75ph6EA==
/
SYS@dave2(db2)> @dave.plb
--再次调用函数,正常使用:
SYS@dave2(db2)> select F_DAVE(4) fromal;
F_DAVE(4)
--------------------------------------------------------------------------------
Dave come from HuaiNing!
--查看函数源码,已经加过密了:
SYS@dave2(db2)> select text fromdba_source where name='F_DAVE';
TEXT
--------------------------------------------------------------------------------
FUNCTION F_DAVE wrapped
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
TEXT
--------------------------------------------------------------------------------
abcd
abcd
abcd
abcd
abcd
abcd
abcd
8
10d e7
S9NWrpt8q6tkKEMxCcfYJz2aLF4wgxDQLZ4VfC9AkE6OnV4ydypXGhveHcDg8UXy98WIg6xR
crtc/BRdQJjutbna/9+g0LlaSx87/znV+y926S1AeC0IRi/tjPJTyvJereDdk8mftMo8QMjV
TEXT
--------------------------------------------------------------------------------
fw0xXn0zVagAawwNVhSAiy/JPTMKkrBkC5ruMwQSTe6JQNq7Q2QtJV0hgQou0rYuet4/gJ5B
wAj75ph6EA==