oracle加密存储过程(函数、包)

oracle提供了一个叫wrap的操作系统命令行工具,用来加密存储过程、函数、包等PL/SQL源代码。防止其他用户对商业逻辑的偷窥,帮助保守商业密码。
语法

wrap iname=input_file [oname=output_file]

input_file为输入文件的名字,该文件含有源代码,output_file为输出文件的名字,oname可选,如果不带oname选项,则生成名字跟输入文件相同,文件后缀为.plb。

示例:

在/home/oracle目录下创建存储过程源文件pro_source.sql,内容为如下:

create or replace procedure hbk_secret is
begin
	dbms_output.put_line('I Love you,zhanglulu,My wife');
end;

使用wrap命令生成加密,加密后的文件为pro_pwd.sql

[root@test11g oracle]# pwd
/home/oracle
[root@test11g oracle]# ll |grep pro_source.sql 
-rw-r--r-- 1 root   root            108 7月  10 17:08 pro_source.sql
[root@test11g oracle]# cat pro_source.sql 
create or replace procedure hbk_secret is
begin
	dbms_output.put_line('I Love you,zhanglulu,My wife');
end;

[root@test11g oracle]# wrap iname=/home/oracle/pro_source.sql oname=/home/oracle/pro_pwd.sql

PL/SQL Wrapper: Release 11.2.0.1.0- 64bit Production on Wed Jul 10 17:09:47 2019

Copyright (c) 1993, 2009, Oracle.  All rights reserved.

Processing /home/oracle/pro_source.sql to /home/oracle/pro_pwd.sql


执行加密后的存储过程文件,将创建相对应的存储过程。

[oracle@test11g ~]$ sqlplus hbk/hbk

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jul 10 17:10:23 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
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> @ /home/oracle/pro_pwd.sql

Procedure created.

执行存储过程

SQL> set serveroutput on;
SQL> execute hbk_secret;
I Love you,zhanglulu,My wife

PL/SQL procedure successfully completed.


查看存储过程的源代码:

SQL > select name,text from all_source where type='PROCEDURE' and name='HBK_SECRET';

查看的结果跟直接使用操作系统命令查看相同,已经加密了。

[root@test11g oracle]# cat pro_pwd.sql 
create or replace procedure hbk_secret wrapped 
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
7
5b 9e
Iglb06MHVSiBupA9nP6gE08Pj34wg5nnm7+fMr2ywFyFWpdKltwu0fJizKV0i8DAMv7Shgb1
UpuySv4osr3nsrMdBjAsriTqsjKuRE/kwsMCl+QJkOVf2zTSbiVuCaSa8gKbR6DDMi720eok
H/bROaY2dP0C

/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

黄宝康

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值