OraclePL/SQL code encryption and decryption

Source: Internet
Author: User
The wrap process of Oracle10gPLSQL is to compress lzstr from the source code lz first, then compress the compressed data into a 40-bit encrypted string shstr, and then compress the encrypted string and

The wrap process of Oracle 10g PL/SQL is to compress lzstr on the source code lz first, then compress the compressed data into a 40-bit encrypted string shstr, and then compress the encrypted string and

Oracle's PL/SQL code encryption can be used to protect business logic in some scenarios. The following is a simple example:

1. Use the Wrap command to encrypt

1. Create an example file pro_wrap. SQL

Create or replace procedure pro_wrap is
Begin
Dbms_output.put_line ('Wrap demo ');
End pro_wrap;

2. Use the wrap command to generate pld Encrypted Files

Wrap iname = c: \ pk \ pro_wrap. SQL oname = c: \ pk \ pro_wrap.plb

C: \ pk> wrap iname = c: \ pk \ pro_wrap. SQL oname = c: \ pk \ pro_wrap.plb

PL/SQL Wrapper: Release 11.2.0.1.0-64bit Production on Tuesday March 25 21:58:20 2014

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

Processing c: \ pk \ pro_wrap. SQL to c: \ pk \ pro_wrap.plb

3. Use the encrypted file pro_wrap.pld to generate a stored procedure

C: \ pk> sqlplus/as sysdba

SQL * Plus: Release 11.2.0.1.0 Production on Tuesday March 25 22:17:19 2014

Copyright (c) 1982,201 0, Oracle. All rights reserved.


Connect:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> set serveroutput on
SQL> @ c: \ pk \ pro_wrap.plb

The process has been created.

SQL> exec pro_wrap;
Wrap Demo

The PL/SQL process is successfully completed.

The exec test shows that the stored procedure is successfully executed.

4. verify whether the code is encrypted.

SQL> set newpage none
SQL> set heading off
SQL> set space 0
SQL> set pagesize 0
SQL> set trimout on
SQL> set trimspool on
SQL> set linesize 2500
SQL> SELECT dbms_metadata.get_ddl ('Procedure ', 'Pro _ WRAP') FROM dual;

Create or replace procedure "SYS". "PRO_WRAP" wrapped
A000000
354
Abcd
Abcd
Abcd
Abcd
Abcd
Abcd
Abcd
Abcd
Abcd
Abcd
Abcd
Abcd
Abcd
Abcd
Abcd
7
50 8d
CKb3/QEp0AIWOH/IyhxS2ffLbrUwg5nnm7 + fMr2ywFwWFpfQlpbyVmmldIvAwDL + 0oYJaWm4
Signature =

We can see that the garbled characters are encrypted.

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.