Oracle encryption tool

Source: Internet
Author: User

The business secrets contained in Oracle stored procedures are sometimes unwilling to be seen by third-party personnel. They can be achieved through encryption of stored procedures.

There are two methods to encrypt the stored procedure: here we will focus on wrap:

WRAP is an operating system-level command provided by Oracle. The principle of its encryption is to first perform LZ compression on the source code lzstr, and then perform the SHA-1 operation on the compressed data to obtain a 40-bit encrypted string shstr, then, the encrypted string and the compressed string are spliced to get shstr + lzstr, and then oracle dual-character conversion (conversion table) is performed on the concatenated string ). Finally, encode the converted string with base64 to obtain the encrypted string of the wrap. Oracle does not provide the unwrap tool. The wrap syntax is as follows:

Wrap INAME = input_file [oname = output_file]

The parameter INAME is the name of the file to be encrypted, and the oname is the name of the encrypted file. If oname is omitted, an encrypted file name with the same name is automatically generated and suffixed with PLB.

Let's demonstrate the usage of the wrap tool. Create a file named test.txt first:

[Oracle @ pigeon ~] $ Which wrap
/U01/product/10.2.0/bin/wrap # directory of wrap
[Oracle @ pigeon ~] $ Wrap iname=test.txt

PL/SQL wrapper: Release 10.2.0.1.0-production on Mon Jan 17 15:14:11 2011

Copyright (c) 1993,200 4, Oracle. All rights reserved.

Processing test.txt to test. PLB
[Oracle @ pigeon ~] $ Ls
Autostartosw. Sh desktop l0db. Sh raw.txt sde2.dmp SDE. dmp startdb. Sh stop. PigeonTest. PLB (Generate a new file with the same name and different suffixes)Test.txt
 

The following shows the content of the two files:

[Oracle @ pigeon ~] $ More test.txt
Create or replace procedure Test
Is
Begin
Dbms_output.put_line ('Welcome to Oracle! ');
End;
/
[Oracle @ pigeon ~] $ More test. PLB
Create or replace procedure Test wrapped
A000000
354
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
ABCD
7
49 85
Zzrhcdohoyayahu + ge2kkyne6l4wg5nnm7 + fmr2ywfznurll7pt0i8damv7shsbsm7jk/IIy
Veeysx0gmcyujoqygzt3bl3kammc8c8c5fhbxw7d6tiu9thqjb/2oab7j44p

/
[Oracle @ pigeon ~] $

The following example uses the ciphertext to create and call the procedure

[Oracle @ pigeon ~] $ Sqlplus/nolog

SQL * Plus: Release 10.2.0.1.0-production on Mon Jan 17 15:16:06 2011

Copyright (c) 1982,200 5, Oracle. All rights reserved.

SQL> Conn/As sysdba;
Connected.

-- Copy ciphertext:
SQL> Create or replace procedure Test wrapped
2 a000000
3 354
4 ABCD
5 ABCD
6 ABCD
7 ABCD
8 ABCD
9 ABCD
10 ABCD
11 ABCD
12 ABCD
13 ABCD
14 ABCD
15 ABCD
16 ABCD
17 ABCD
18 ABCD
19 7
20 49 85
21 zzrhcdohoyayahu + ge2kkyne6l4wg5nnm7 + fmr2ywfznurll7pt0i8damv7shsbsm7jk/IIy
22 veeysx0gmcyujoqygzt3bl3kammc8c8c5fhbxw7d6tiu9thqjb/2oab7j44p
23
24/

Procedure created.

When there are many files to be encrypted, you can also do the following:

SQL>Start/home/Oracle/test. PLB;

Procedure created.

SQL>

SQL> set serveroutput on;
SQL> exec test; # execute the test process and output it correctly
Welcome to Oracle!

PL/SQL procedure successfully completed.

SQL>

Now we can send the test. PLB file to the customer, without worrying about the exposure of your source code.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.