使用wrap/fyunwrap加密解密oracle的PL/SQL对象(package, function, procedure...)

wrap 加密函数

  1. 创建一个函数,求最大公约数
CREATE OR REPLACE FUNCTION GETGYS(NUM1 NUMBER, NUM2 NUMBER) RETURN NUMBER IS
   RESULTNUM NUMBER;
   NUM3      NUMBER;
   MINNUM    NUMBER;
 BEGIN
   IF NUM1 >= NUM2 THEN
     MINNUM := NUM2;
   ELSE
     MINNUM := NUM1;
   END IF;
   NUM3 := MINNUM;
   LOOP
     IF (MOD(NUM1, NUM3) = 0 AND MOD(NUM2, NUM3) = 0) THEN
       RESULTNUM := NUM3;
       EXIT;
      END IF;
     NUM3 := NUM3 - 1;
   END LOOP;
   RETURN(RESULTNUM);
 END GETGYS;
  1. 查看dba_source,可以看到源码
SQL> select text from dba_source where name='GETGYS';
FUNCTION GETGYS(NUM1 NUMBER, NUM2 NUMBER) RETURN NUMBER IS
  RESULTNUM NUMBER;
  NUM3      NUMBER;
  MINNUM    NUMBER;
BEGIN
  IF NUM1 >= NUM2 THEN
    MINNUM := NUM2;
  ELSE
    MINNUM := NUM1;
  END IF;
  NUM3 := MINNUM;
  LOOP
    IF (MOD(NUM1, NUM3) = 0 AND MOD(NUM2, NUM3) = 0) THEN
      RESULTNUM := NUM3;
      EXIT;
     END IF;
    NUM3 := NUM3 - 1;
  END LOOP;
  RETURN(RESULTNUM);
END GETGYS;
  1. 使用wrap加密GETGYS。
    将GETGYS保存到文本文件中(t_getgys.sql)
    使用wrap命令加密
 [oracle@upright92 ~]$ wrap iname=t_getgys.sql 
PL/SQL Wrapper: Release 11.2.0.4.0- 64bit Production on Thu Jun 13 13:56:36 2019
Copyright (c) 1993, 2009, Oracle.  All rights reserved.
Processing t_getgys.sql to t_getgys.plb

连接到数据库,执行加密后的文件t_getgys.plb

sqlplus scott/tiger
@t_getgys.plb
select GETGYS(1,10) from dual;  --函数运行正常
GETGYS(1,10)
------------
	   1

–查看dba_source视图,加密成功

SQL> select text from dba_source where name='GETGYS';
FUNCTION GETGYS wrapped
a000000
1
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
abcd
8
1a9 124
P/vGjXxjKuNy7Jbz6whJJut7jv4wg3n3csusfHTUAE6OAMKitjcTmRtmRJzdyXAM0nMP2+Kk
S9Z2BHMQc04ydK8i7VJvYNKGv2J5ddUO6gfZrUEyno5WfWrgXufJYqbjOzibRtM88yUXHeSR
uN/f6ENLarO0TVj7MIrtjfT5Akf+5RPnaOewlLXjjeNhsEgHmSUUbbNdaLry3uCtmEHEQyr9
RGJx7jWB9LGI6lhjz96IVX0ur9AIusiTrUelQjdqfqAaQxuGzacSIOkhG4Ugs5UpW4gcD2o=

利用fyunwrap解密

该软件目前仅支持32位的windows操作系统

  1. 软件下载地址
链接:https://pan.baidu.com/s/1ic65l7ISvF06FZp5N_BVKQ 
提取码:68y9 
  1. 图形操作工具,简单易用
    使用wrap/fyunwrap加密解密oracle的PL/SQL对象(package, function, procedure...)_第1张图片

你可能感兴趣的:(Oracle)