Oracle provides wrap tools to encrypt your package.
However, the encrypted code cannot be decrypted. You need to keep your source code safe.
The following is an example:
1. Source Code
Create or replace function get_rowid
(L_rowid in varchar2)
Return varchar2
Is
Ls_my_rowid varchar2 (200 );
Rowid_type number;
Object_number number;
Relative_fno number;
Block_number number;
Row_number number;
Begin
Dbms_rowid.rowid_info (l_rowid, rowid_type, object_number, relative_fno, block_number, row_number );
Ls_my_rowid: = 'object # is: '| to_char (object_number) | CHR (10) |
'Relative _ fno is: '| to_char (relative_fno) | CHR (10) |
'Block number is: '| to_char (block_number) | CHR (10) |
'Row number is: '| to_char (row_number );
Return ls_my_rowid;
End;
/
2. Code function test
[Oracle @ jumper tools] $ sqlplus Scott/Tiger
SQL * Plus: Release 9.2.0.4.0-production on Mon Nov 15 21:56:36 2004
Copyright (c) 1982,200 2, Oracle Corporation. All rights reserved.
Connected:
Oracle9i Enterprise Edition Release 9.2.0.4.0-Production
With the partitioning Option
Jserver release 9.2.0.4.0-Production
SQL> @ f_get_rowid
Function created.
SQL> select rowid from Dept where deptno = 10;
Rowid
------------------
Aaabipaabaaafrsaaa
SQL> select get_rowid ('aaabipaabaaafrsaa') from dual;
Get_rowid ('aaabipaabaaafrsaa ')
------------------------------------------------------------------
Object # Is: 6287
Relative_fno is: 1
Block number is: 21586
Row number is: 0
SQL>!
[Oracle @ jumper tools] $ ls
Ct. SQL ddlt. SQL f_get_rowid. SQL getevent. SQL
3. Use wrap encryption and encrypted code
[Oracle @ jumper tools] $ wrap INAME = f_get_rowid. SQL oname = f_get_rowid.plb
PL/SQL wrapper: Release 9.2.0.4.0-production on Mon Nov 15 21:59:39 2004
Copyright (c) Oracle Corporation 1993,200 1. All rights reserved.
Processing f_get_rowid. SQL to f_get_rowid.plb
[Oracle @ jumper tools] $ cat f_get_rowid.plb
Create or replace function get_rowid wrapped
0
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
3
8
9200000
1
4
0
17
2: e:
1 function:
1get_rowid:
1l_rowid:
1varchar2:
1 return:
1ls_my_rowid:
1200:
1rowid_type:
1 Number:
1object_number:
1relative_fno:
1block_number:
1row_number:
1dbms_rowid:
1rowid_info:
1 object # Is :::
1 |:
1to_char:
1chr:
110:
1relative_fno is :::
1 block number is :::
1row number is :::
0
0
0
83
2
0 A0 8d 8f A0 B0 3D B4
: 2 A0 2C 6a A3 A0 51 A5 1c
81 B0 A3 A0 1C 81 B0 A3
A0 1C 81 B0 A3 A0 1C 81
B0 A3 A0 1C 81 B0 A3 A0
1c 81 B0: 2 A0 6B: 6 A0 A5 57
A0 6e 7e: 2 A0 A5 B B4 2e
7E A0 51 A5 B B4 2E 7E
6e B4 2E 7e: 2 A0 A5 B B4
2e 7E A0 51 A5 B B4 2e
7E 6e B4 2E 7e: 2 A0 A5 B
B4 2E 7E A0 51 A5 B B4
2e 7E 6e B4 2E 7e: 2 A0 A5
B B4 2E D: 2 A0 65 B7 A4
B1 11 68 4f 1D 17 B5
83
2
0 3 7 23 1f 1E 2B 1b
30 34 38 3C 59 44 48 4B
4c 54 43 75 64 68 70 40
8d 7C 80 88 63 A9 98 9C
A4 60 C1 B0 B4 BC 97 dd
CC D0 D8 94 C8 E4 E8 EB
EF F3 F7 fb ff 103 104 109
10d 112 115 119 11d 11E 120 121
126 129 12D 130 131 133 134
13C 141 142 147 14a 14E 152 153
155 156 15B 15e 162 165 166
169 16E 171 176 177 17C 17f 183
187 188 18A 18B 190 193 197 19a
19b 19D 19E 1a3 1A6 1AB 1ac 1B1
1B4 1b8 1bc 1bd 1bf 1c0 1C5 1c9
1cd 1d1 1d5 1d7 1db 1dd 1e9 1ED
1ef 1f0 1f9
83
2
0 1 A 2 D: 2 2: 2 1 8
: 3 1 E 17 16: 2 E: 2 1: 3 D: 2 1
: 3 10: 2 1: 3 F: 2 1: 3 F: 2 1: 3 D 1
2: 2 D 18 20 2B 39 47 55
: 3 2 11 24 26 2E: 2 26: 2 11 3C
3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D 64 69
: 3 0 11: 2 0 17
: 4 0 40 6B 6d
: 3 0 11: 2 0 12
: 3 0 D: 3 0 43
70 72 45 6f
74: 3 0 37 75
0 7A 5: 3 0
6: 3 0 78: 2 0
7A 48 7d: 3 0
7D 4C 7d 7c
7A 7b: 6 0 7E
: 2 0 2 a 7D
81: 3 0 80 7E
82: 8 0
53
4
: 3 0 1 3 1
6 1 E 1
C 1 13 1
18 1 1D 1
22 1 27 6
2f 30 31 32
33 34 1 3B
2 38 3D 1
42 2 3f 44
2 46 48 1
4d 2 4A 4f
1 54 2 51
56 2 58 5A
1 5f 2 5C
61 1 66 2
63 68 2 6a
6c 1 71 2
6e 73 3 36
76 79 6 11
16 1B 20 25
2a
1
4
0
81
0
1
14
1
8
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0
3 1 0
22 1 0
2 0 1
C 1 0
13 1 0
27 1 0
18 1 0
1D 1 0
0
/
4. Test the encrypted code
[Oracle @ jumper tools] $ exit
Exit
SQL> drop function get_rowid;
Function dropped.
SQL> @ f_get_rowid.plb
Function created.
SQL> select get_rowid ('aaabipaabaaafrsaa') from dual;
Get_rowid ('aaabipaabaaafrsaa ')
-----------------------------------------------------------------
Object # Is: 6287
Relative_fno is: 1
Block number is: 21586
Row number is: 0
SQL>
Author:
Eygle, Oracle technical expert, from China's largest Oracle technology forum itpub.
Www.eygle.com is the author's personal site. You can contact the author through Guoqiang.Gai@gmail.com. Welcome to technical discussion and link exchange.
Source:
Http://www.eygle.com/faq/Use.Wrap.to.Encryption.You.Code.htm
============================================
Encrypted storage process
When you create a process or function, you can first write the relevant commands into an SQL file, then use warp to encrypt the file, and execute the command block in SQL plus, then the created Function
Or the process is encrypted. This function is often used for commercial encryption.
======================================
I don't know which hero has used the wrap encryption tool in Oracle?
I use
C:/> wrap INAME = file1. SQL
It can be a line of words.
Still not used,
==================================
Add a C:/> set nls_language = us
========================================================== =
Oracle Stored Procedure Encryption
Oracle provides wrap tools to encrypt PL/SQL source code, including procedure, function, and package.
Running wrap in the OS command line Environment
Syntax: Wrap INAME = input_file [oname = output_file]
Restrictions: strings, numbers, variable names, table names, and field names are retained in the encrypted file. Only encryption rules are allowed and decryption is restricted. Therefore, the table name or password cannot be hidden.
In some new SQL syntaxes, You need to specify the option edebug = wrap_new_ SQL. Otherwise, it cannot be supported.
Note:
1. Wrap can only detect basic syntax errors, but it cannot check semantic errors because it does not log on to the database.
2. compatible with the previous version, but not backward compatible. That is, the encryption process of the earlier version can be compiled on the later version.
3. The encrypted package only encrypts the package body, but does not encrypt the package declaration.
4. An error is displayed during execution on Windows: kgepop: no error frame to pop to for error 1801.
You need to first define set nls_lang = american_america.zhs16gbk
Example:
Source code
Create or replace procedure p_test
(
I _var in varchar2,
O_var out varchar2
) Is
Begin
O_var: = I _var;
End p_test;
/
Encrypted File
Create or replace procedure p_test wrapped
0
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
3
7
9200000
1
4
0
5
2: e:
1p_test:
1i_var:
1varchar2:
1o_var:
1out:
0
0
0
1B
2
0 9A 8f A0 B0 3D 96: 2 A0
B0 54 B4 55 6a: 2 A0 D B7
A4 A0 B1 11 68 4f 1D 17
B5
1B
2
0 3 1f 1B 1A 27 38 30
34 17 3f 2f 44 48 4C 50
54 2C 58 5C 60 62 6e 72
74 75 7E
1B
2
0 B 4 D: 3 4 A E: 2 4
: 3 1 4 D 4: 2 1 5: 7 1
1B
4
0 1: 4 3: 5 4
2: 2 1: 3 7: 2 6
8: 7 1
80
4
: 3 0 1: A 0 16
1: 7 0 5 2C
0: 2 3: 3 0 2
: 7 0 4 3: 3 0
A 15 0 7
5: 3 0 3: 3 0
4: 6 0 9 8
: 3 0 B: 2 0 16
1 C: 2 0 4
: 3 0 2: 3 0 e
F 0 11: 3 0
15 1: 4 0 15
14 11 12: 6 0
16: 2 0 1 c
15 19: 3 0 18
16 1a: 8 0
C
4
: 3 0 1 2 1
6 2 5
1 10
1
4
0
19
0
1
14
1
3
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0
1 0 1
6 1 0
2 1 0
0
/
If the encrypted file name is not specified, it is the master file of the original file. PLB
After encryption, use SQL> @ to encrypt the file name and compile it into the database. The encrypted file is displayed.
For example, in PL/SQL developer, view/* Source is wrapped */
==========================================
Wrap can only encrypt processes, packages, and functions. If you want to encrypt the trigger, you can first write a process, encrypt the process, and then call this process in the trigger.