熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

使用OracleWrap工具加密你的代碼

2022-06-13   來源: Oracle 

  Oracle提供Wrap工具可以用於加密你的Package等

  不過需要注意的是加密後的代碼無法解密你需要保管好你的源代碼

  以下是個例子:

  源代碼

  create or replace function get_rowid
(l_rowid in varchar)
return varchar
is
ls_my_rowid     varchar();
rowid_type      number;
object_number   number;
relative_fno    number;
block_number    number;
row_number      number;
begin
 dbms_rowidrowid_info(l_rowidrowid_typeobject_numberrelative_fno block_number row_number);
 ls_my_rowid := Object# is      :||to_char(object_number)||chr()||
                Relative_fno is :||to_char(relative_fno)||chr()||
                Block number is :||to_char(block_number)||chr()||
                Row number is   :||to_char(row_number);
 return ls_my_rowid ;
end;
/

  代碼功能測試

  [oracle@jumper tools]$ sqlplus scott/tiger

  SQL*Plus: Release Production on Mon Nov ::

  Copyright (c) Oracle Corporation  All rights reserved

  Connected to:
Oraclei Enterprise Edition Release Production
With the Partitioning option
JServer Release Production

  SQL> @f_get_rowid

  Function created

  SQL> select rowid from dept where deptno=;

  ROWID

AAABiPAABAAAFRSAAA

  SQL> select get_rowid(AAABiPAABAAAFRSAAA) from dual;

  GET_ROWID(AAABIPAABAAAFRSAAA)

Object# is      :
Relative_fno is :
Block number is :
Row number is   :

  SQL> !
[oracle@jumper tools]$ ls
ctsql  ddltsql  f_get_rowidsql  geteventsql

  使用wrap加密及加密後的代碼

  [oracle@jumper tools]$ wrap iname=f_get_rowidsql oname=f_get_rowidplb

  PL/SQL Wrapper: Release Production on Mon Nov ::

  Copyright (c) Oracle Corporation   All Rights Reserved

  Processing f_get_rowidsql to f_get_rowidplb

  [oracle@jumper tools]$ cat f_get_rowidplb
create or replace function get_rowid wrapped

abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd







:e:
FUNCTION:
GET_ROWID:
L_ROWID:
VARCHAR:
RETURN:
LS_MY_ROWID:
:
ROWID_TYPE:
NUMBER:
OBJECT_NUMBER:
RELATIVE_FNO:
BLOCK_NUMBER:
ROW_NUMBER:
DBMS_ROWID:
ROWID_INFO:
Object# is      :::
||:
TO_CHAR:
CHR:
:
Relative_fno is :::
Block number is :::
Row number is   :::

  



a d f a b d b
: a c a a a a c
b a a c b a
a c b a a c
b a a c b a a
c b : a b : a a
a e e : a a b b e
e a a b b e e
e b e e : a a b b
e e a a b b e
e e b e e : a a b
b e e a a b b
e e e b e e : a a
b b e d : a b a
b f d b


f e b b
c b
c
d c a c
a c b b bc dd
cc d d c e e eb
ef f f fb ff
d d e
d
c a e
b e
e c f
a b a
b d e a a ab ac b
b b bc bd bf c c c
cd d d d db dd e ed
ef f f


a d : :
: e : e : : d :
: : : f : : f : : d
: d b
: e : : c
e : e : :
: : d f : f
: : :
: d f : f :
: : : :
:


: : :
: : : :
: : : a :b c
: d e : d : e
: d : e : d e
f : d : f : d
: f : d f
: d : : d :
: b :
fb

: :
:a e :
:
: :
: :
:
e a
: b
:
: d f
:
c :
f d
: :
c
:
: : c
a c
a : c
:
e : f
c b
: :
:
c c :
e : :
: b
c d
: f : c
d :
: a :
b : c :
d : e
: a
: :
: : a
: c a c
e e :
: :
:

: :
:
: :
: b :
c e b b
: :
: :
e
:
: :
b :
: : c
: e
d :
: :
: b
d
: :
: b d
: :
: d :
f
:
a :
: :
a d :
d c d c
a b : e
: a d
: e
:


:
e
c
d

f
b
d
f

d a f

a
f c

a
c
e

b
a















c



d

  /

  測試加密後的代碼

  [oracle@jumper tools]$ exit
exit

  SQL> drop function get_rowid;

  Function dropped

  SQL> @f_get_rowidplb

  Function created

  SQL> select get_rowid(AAABiPAABAAAFRSAAA) from dual;

  GET_ROWID(AAABIPAABAAAFRSAAA)

Object# is      :
Relative_fno is :
Block number is :
Row number is   :

  SQL>


From:http://tw.wingwit.com/Article/program/Oracle/201311/17070.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.