ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Tips--在Oracle中如何加密我们的代码

Tips--在Oracle中如何加密我们的代码

原创 Linux操作系统 作者:vongates 时间:2019-03-09 21:24:07 0 删除 编辑

有时候是商业用途,或个人知识产权,我们不想别人看到程序的源代码。在Oracle中我们可以先用wrap这个工具对source code加密后再放到DB中去,之前很少用,现因特殊状况需对一些代码加密后再放到数据库中。下面帖一个例子,很简单只是一个in,还有一个out就可以了。


C:UserData>type collect_all_db_account_info.SQL
CREATE OR REPLACE PROCEDURE collect_all_db_account_info IS
CURSOR c_DB_LINK IS
SELECT HOST FROM USER_DB_LINKS;
BEGIN

for r_link in c_db_link loop
EXECUTE IMMEDIATE 'INSERT INTO perfadm.all_db_account_info SELECT DISTINCT v
d.dbid db_id, vd.NAME db_name, d.username, d.PASSWORD,d.account_status, d.defaul
t_tablespace,d.temporary_tablespace, d.PROFILE, d.created, p.SYSDBA,p.SYSOPER, S
YSDATE collect_date FROM
v$database@'||r_link.host||' vd, dba_users@'||r_link.ho
st||' d, v$pwfile_users@'||r_link.host||' p WHERE p.username(+) = d.username';
COMMIT;
end loop;
COMMIT;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END collect_all_db_account_info;
/

C:UserData>wrap iname=collect_all_db_account_info.SQL oname=wcollect_all_db_account_info.plb

PL/SQL Wrapper: Release 9.2.0.6.0- Production on Fri Jul 14 15:52:18 2006

Copyright (c) Oracle Corporation 1993, 2001. All Rights Reserved.

Processing collect_all_db_account_info.SQL to wcollect_all_db_account_info.plb

C:UserData>type wcollect_all_db_account_info.plb
CREATE OR REPLACE PROCEDURE collect_all_db_account_info wrapped
0
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
3
7
9200000
1
4
0
12
2 :e:
1COLLECT_ALL_DB_ACCOUNT_INFO:
1CURSOR:
1C_DB_LINK:
1HOST:
1USER_DB_LINKS:
1R_LINK:
1LOOP:
1EXECUTE:
1IMMEDIATE:
1INSERT INTO perfadm.all_db_account_info SELECT DISTINCT vd.dbid db_id, vd.NAM+
1E db_name, d.username, d.PASSWORD,d.account_status, d.default_tablespace,d.te+
1mporary_tablespace, d.PROFILE, d.created, p.SYSDBA,p.SYSOPER, SYSDATE collect+
1_date FROM v$database@:
1||:
1 vd, dba_users@:
1 d, v$pwfile_users@:
1 p WHERE p.username(+) = d.username:
1COMMIT:
1NO_DATA_FOUND:
1OTHERS:
1RAISE:
0

0
0
62
2
0 9a b4 55 6a a0 f4 b4
bf c8 a0 ac a0 b2 ee ac
d0 e5 e9 bd b7 11 a4 b1
91 :2 a0 37 :2 a0 6e 7e :2 a0 6b
b4 2e 7e 6e b4 2e 7e :2 a0
6b b4 2e 7e 6e b4 2e 7e
:2 a0 6b b4 2e 7e 6e b4 2e
11e 11d a0 57 a0 b4 e9 b7
a0 47 a0 57 a0 b4 e9 b7
a0 4f b7 a6 9 a0 53 a0
62 b7 a6 9 a4 a0 b1 11
68 4f 1d 17 b5
62
2
0 3 17 18 1c 20 24 35
36 39 3d 41 42 46 47 4e
4f 53 59 5e 63 65 71 75
77 7b 7f 83 85 89 8d 92
95 99 9d a0 a1 a6 a9 ae
af b4 b7 bb bf c2 c3 c8
cb d0 d1 d6 d9 dd e1 e4
e5 ea ed f2 f3 f8 fd 101
105 10a 10e 10f 114 116 11a 121
125 12a 12e 12f 134 136 13a 13c
13e 13f 144 1 148 14c 14f 151
152 157 15b 15f 161 16d 171 173
174 17d
62
2
0 b 0 :2 1 4 b 0 :2 4
:2 c 16 11 16 11 :3 5 :5 4 7
11 1b 3 5 d 17 116 118
:2 11f :2 17 123 125 :2 17 136 138 :2 13f
:2 17 143 145 :2 17 15a 15c :2 163 :2 17
167 169 :2 17 :7 5 1b 7 :6 3 1
8 5 16 :2 3 :2 8 :2 5 f :2 3
1 5 :7 1
62
4
0 1 0 :2 1
:2 2 0 :2 2 :9 3
:5 2 :4 6 :23 7 :5 8
6 9 6 :5 a
4 c d :3 c
:2 e :2 10 :3 e b
11 :7 1
17f
4
:3 0 1 :a 0 5d
1 :8 0 2 :2 0
5d 1 3 :2 0
2 :3 0 3 :a 0
2 13 :5 0 6
9 0 7 :3 0
4 :3 0 3 5
:3 0 5 d :2 0
f :5 0 b e
0 10 :6 0 11
:2 0 14 6 9
15 0 5b 7
15 17 14 16
:6 0 13 :7 0 15
6 :3 0 3 :3 0
7 :3 0 18 19
8 :3 0 9 :3 0
a :4 0 b :2 0
6 :3 0 4 :3 0
20 21 0 9
1f 23 :3 0 b
:2 0 c :4 0 c
25 27 :3 0 b
:2 0 6 :3 0 4
:3 0 2a 2b 0
f 29 2d :3 0
b :2 0 d :4 0
12 2f 31 :3 0
b :2 0 6 :3 0
4 :3 0 34 35
0 15 33 37
:3 0 b :2 0 e
:4 0 18 39 3b
:3 0 3c :4 0 3d
:2 0 44 f :3 0
41 42 :2 0 43
f :5 0 40 :2 0
44 1b 46 7
:3 0 1b 44 :4 0
4c f :3 0 49
4a :2 0 4b f
:5 0 48 :2 0 4c
1e 5c 10 :4 0
4f 21 51 23
50 4f :2 0 59
11 :3 0 12 :5 0
56 25 58 27
57 56 :2 0 59
29 :2 0 5c 1
:3 0 2c 5c 5b
4c 59 :6 0 5d
:2 0 1 3 5c
60 :3 0 5f 5d
61 :8 0
2e
4
:3 0 1 a 1
c 1 12 2
1e 22 2 24
26 2 28 2c
2 2e 30 2
32 36 2 38
3a 2 3e 43
2 46 4b 1
4e 1 4d 1
55 1 53 2
51 58 1 13

1
4
0
60
0
1
14
3
3
0 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0
6 1 2
1 0 1
18 3 0
0

/

C:UserData>
C:UserData>sqlplus /nolog

SQL*Plus: Release 9.2.0.6.0 - Production on Fri Jul 14 15:53:36 2006

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> conn perfadm@perfdb226
Enter password:
Connected.
SQL> drop procedure collect_all_db_account_info;

Procedure dropped.

SQL> @wcollect_all_db_account_info.plb

Procedure created.

SQL>

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29987/viewspace-51961/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2018-09-11

  • 博文量
    204
  • 访问量
    146345