最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
oracle怎么加密 Oracle加密

Oracle如何加密視圖源碼?

最簡(jiǎn)單的,把sys收了,異用戶查詢授權(quán)。

成都創(chuàng)新互聯(lián)主要從事網(wǎng)站制作、網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)尖扎,十年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18982081108

要是涉及到代碼移交,那就用函數(shù)實(shí)現(xiàn)view,然后用DBMS_DDL.WRAP加密

Oracle下如何用wrap加密自己的源代碼

可以使用wrap 工具或者DBMS_DDL子程序?qū)L/SQL源碼進(jìn)行加密。wrap工具加密單個(gè)源文件,如SQL*Plus腳本。DBMS_DDL子程序加密單個(gè)動(dòng)態(tài)生成的PL/SQL單元,如一個(gè)CREATE PROCEDURE聲明。加密的源文件可以移動(dòng),備份,可被SQL*Plus和Improt和Export工具處理,但在靜態(tài)數(shù)據(jù)字典視圖*_SOURCE中無法看到源碼。 WRAP語(yǔ)法 wrap iname=input_file [oname=output_file ] 可省略文件擴(kuò)展名,如以下的命令是等同的: wrap iname=/mydir/myfile wrap iname=/mydir/myfile.sql 輸出文件默認(rèn)的擴(kuò)展名為.plb,當(dāng)然你也可以指定不同的文件名和擴(kuò)展名。 wrap iname=/mydir/myfile oname=/yourdir/yourfile.out wrap主要是混淆PL/SQL語(yǔ)句的主體部分,如下CREATE語(yǔ)句可以被加密: CREATE [OR REPLACE] FUNCTION function_name

CREATE [OR REPLACE] PROCEDURE procedure_name

CREATE [OR REPLACE] PACKAGE package_name

CREATE [OR REPLACE] PACKAGE BODY package_name

CREATE [OR REPLACE] TYPE type_name AS OBJECT

CREATE [OR REPLACE] TYPE type_name UNDER type_name

CREATE [OR REPLACE] TYPE BODY type_name CREATE [OR REPLACE] TRIGGER語(yǔ)句不能被加密,但你可調(diào)用加密的過程。加密文件中除了語(yǔ)句頭部和C風(fēng)格(/*…*/)注釋外,其它所有注釋被刪除。

關(guān)于oracle數(shù)據(jù)庫(kù)加密的函數(shù)

Oracle 提供兩種加密方式:

a)加密 API 例如包 和 dbms_crypto 使用這些包,可以構(gòu)建我們自己的基礎(chǔ)架構(gòu),對(duì)數(shù)據(jù)進(jìn)行加密。 這種方法的靈活性最強(qiáng),但是構(gòu)建和管理卻相當(dāng)復(fù)雜。

b)透明的數(shù)據(jù)加密是 Oracle 數(shù)據(jù)庫(kù) ;使用該特性后,就不必手動(dòng)進(jìn)行密碼管理了。

數(shù)據(jù)庫(kù)管理密碼,但是正如名稱所指,加密是透明的——數(shù)據(jù)僅僅以加密的方式存儲(chǔ)而已。在Oracle10g中出現(xiàn)了dbms_crypto替代了之前的dbms_obfuscation_toolkit,DBMS_CRYPTO增加了若干新的加密算法、哈希算法。

DBMS_CRYPTO還撤銷了對(duì)于public組的執(zhí)行權(quán)限。

如何在oracle 10g r2中實(shí)現(xiàn)透明數(shù)據(jù)加密

設(shè)置加密密鑰:

Oracle 透明數(shù)據(jù)加密提供了實(shí)施加密所必需的關(guān)鍵管理基礎(chǔ)架構(gòu)。 加密的工作原理是將明文數(shù)據(jù)以及秘密(稱作密鑰)傳遞到加密程序中。 加密程序使用提供的密鑰對(duì)明文數(shù)據(jù)進(jìn)行加密,然后返回加密數(shù)據(jù)。 以往,創(chuàng)建和維護(hù)密鑰的任務(wù)由應(yīng)用程序完成。 Oracle 透明數(shù)據(jù)加密通過為整個(gè)數(shù)據(jù)庫(kù)自動(dòng)生成一個(gè)萬能密鑰解決了此問題。 在啟動(dòng) Oracle 數(shù)據(jù)庫(kù)時(shí),管理員必須使用不同于系統(tǒng)口令或 DBA 口令的口令打開一個(gè) Oracle Wallet 對(duì)象。 然后,管理員對(duì)數(shù)據(jù)庫(kù)萬能密鑰進(jìn)行初始化。 萬能密鑰是自動(dòng)生成的。

性能:

由于索引數(shù)據(jù)未被加密,因此加密通常會(huì)影響現(xiàn)有的應(yīng)用程序索引。 Oracle 透明數(shù)據(jù)加密對(duì)與給定應(yīng)用程序表關(guān)聯(lián)的索引值進(jìn)行加密。 這意味著應(yīng)用程序中的相等搜索對(duì)性能的影響很小,甚至沒有任何影響。 例如,假設(shè)應(yīng)用程序 card_id存在一個(gè)索引,并且此應(yīng)用程序執(zhí)行以下語(yǔ)句:

SQL Select cash from credit_card where card_id = '1025023590';

Oracle 數(shù)據(jù)庫(kù)將使用現(xiàn)有的應(yīng)用程序索引,盡管 card_id信息已經(jīng)在數(shù)據(jù)庫(kù)中加密。

準(zhǔn)備用于加密的數(shù)據(jù)庫(kù):

在本部分內(nèi)容中,您將更新 sqlnet.ora、創(chuàng)建一個(gè)加密錢夾 (ewallet.p12)、打開此錢夾并為 TDE創(chuàng)建萬能密鑰。執(zhí)行以下操作:

1. 您需要更新 sqlnet.ora 文件以包含一個(gè) ENCRYPTED_WALLET_LOCATION 條目。打開一個(gè)終端窗口,然后輸入以下命令:

cd $ORACLE_HOME/network/admin

gedit sqlnet.ora

將以下條目添加到文件末尾:

ENCRYPTION_WALLET_LOCATION=(SOURCE=(METHOD=FILE)(METHOD_DATA=(DIRECTORY=/opt/oracle/admin/test97/wallet/)))

如果不加這一項(xiàng)的話,則會(huì)提示下面錯(cuò)誤:

SQL alter system set key identified by "hurray"

2 ;

alter system set key identified by "hurray"

*

ERROR at line 1:

ORA-28368: cannot auto-create wallet

/opt/oracle/admin/test97/wallet/ 目錄是用來存放生成的錢夾的。

可以為加密錢夾選擇任何目錄,但路徑不應(yīng)指向在數(shù)據(jù)庫(kù)安裝過程中創(chuàng)建的標(biāo)準(zhǔn)模糊錢夾(cwallet.sso)。

2. 接下來,您需要打開錢夾并創(chuàng)建萬能加密密鑰。從終端窗口中,輸入以下命令:

connect / as sysdbaalter system set key identified by "welcome1";

此命令的作用為:

l 如果指定的目錄中不存在加密錢夾,則將創(chuàng)建加密錢夾 (ewallet.p12)、打開此錢夾并創(chuàng)建/重新創(chuàng)建 TDE 的萬能密鑰。

l 如果指定目錄中存在加密錢夾,則將打開此錢夾并創(chuàng)建/重新創(chuàng)建 TDE 的萬能密鑰。

之后,就可以測(cè)試數(shù)據(jù)了。

下面是實(shí)驗(yàn)記錄:

alter system set key identified by "welcome1";

SQL conn dodd/dodd123

create table test (id number,credit_card_number varchar2(16) ENCRYPT NO SALT);

SQL insert into test values(1,'1231243242');

1 row created.

SQL insert into test values(2,'33245235');

SQL commit;

Commit complete.

SQL select * from test;

ID CREDIT_CARD_NUMB

---------- ----------------

1 1231243242

2 33245235

可見,數(shù)據(jù)查看是明文,因?yàn)檫@個(gè)時(shí)候,加密錢夾已經(jīng)打開,數(shù)據(jù)可以解密。

這時(shí),停止數(shù)據(jù)庫(kù),再打開:

SQL shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL SQL startup

ORACLE instance started.

Total System Global Area 524288000 bytes

Fixed Size 1979968 bytes

Variable Size 138414528 bytes

Database Buffers 377487360 bytes

Redo Buffers 6406144 bytes

Database mounted.

Database opened.

SQL select * from dodd.test;

select * from dodd.test

*

ERROR at line 1:

ORA-28365: wallet is not open

SQL select id from dodd.test;

ID

----------

1

2

可以看到,因?yàn)閿?shù)據(jù)庫(kù)重啟后,加密錢夾處于關(guān)閉狀態(tài),這時(shí)只要查詢到加密的列,會(huì)提示加密錢夾沒有打開。

如果用戶想打開錢夾,必須具有alter system權(quán)限。

下面打開wallet:

SQL conn / as sysdba

Connected.

SQL alter system set wallet open identified by "welcome1";

System altered.

SQL conn dodd/dodd123

Connected.

SQL select * from test;

ID CREDIT_CARD_NUMB

---------- ----------------

1 1231243242

2 33245235

可以看到,加密錢夾打開后,數(shù)據(jù)可以被解密。

還有一條:sys用戶的表不能被加密。

可見:Oracle TDE是在數(shù)據(jù)層面上對(duì)表里的數(shù)據(jù)加密,而且不會(huì)影響數(shù)據(jù)庫(kù)現(xiàn)有的權(quán)限控制策略。

salt實(shí)際上就是在加密過程中引入一個(gè)隨機(jī)性。簡(jiǎn)單的說,就是一般來說,同樣的明文產(chǎn)生同樣的密文,這樣就導(dǎo)致容易被解密者通過分析詞頻之類的方式(加解密我不太懂)來通過密文破解明文,如果指定salt,那么即使同樣的明文加密后的密文也是不一樣的。

no salt的話,自然就是相同的明文會(huì)產(chǎn)生相同的密文了。對(duì)于索引來說,要求no salt也就可以理解了

丟失ewallet加密錢夾的話,是不能再解密數(shù)據(jù)的。

Oracle 10gR2的 TDE 特性,對(duì)于防止機(jī)密信息的泄漏能起到事半功倍的作用!

Oracle--使用Wrap工具加密你的SQL

Oracle提供Wrap工具 可以用于加密你的Package等

不過需要注意的是 加密后的代碼無法解密 你需要保管好你的源代碼

以下是個(gè)例子

源代碼

create or replace function get_rowid

(l_rowid in varchar )

return varchar

is

ls_my_rowid???? varchar ( )

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( )||

Relative_fno is : ||to_char(relative_fno)||chr( )||

Block number is : ||to_char(block_number)||chr( )||

Row number is?? : ||to_char(row_number)

return ls_my_rowid ;

end;

/

代碼功能測(cè)試

[oracle@jumper tools]$ sqlplus scott/tiger

SQL*Plus: Release Production on Mon Nov : :

Copyright (c) Oracle Corporation ? All rights reserved

Connected to:

Oracle i Enterprise Edition Release Production

With the Partitioning option

JServer Release Production

SQL @f_get_rowid

Function created

SQL select rowid from dept where deptno= ;

ROWID

AAABiPAABAAAFRSAAA

SQL select get_rowid( AAABiPAABAAAFRSAAA ) from dual;

GET_ROWID( AAABIPAABAAAFRSAAA )

Object# is????? :

Relative_fno is :

Block number is :

Row number is?? :

SQL !

[oracle@jumper tools]$ ls

ct sql? ddlt sql? f_get_rowid sql? getevent sql

使用wrap加密及加密后的代碼

[oracle@jumper tools]$ wrap iname=f_get_rowid sql oname=f_get_rowid plb

PL/SQL Wrapper: Release Production on Mon Nov : :

Copyright (c) Oracle Corporation ? 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

abcd

abcd

abcd

abcd

abcd

abcd

abcd

abcd

abcd

abcd

abcd

abcd

abcd

abcd

abcd

:e:

FUNCTION:

GET_ROWID:

L_ROWID:

VARCHAR :

RETURN:

LS_MY_ROWID:

:

ROWID_TYPE:

NUMBER:

OBJECT_NUMBER:

RELATIVE_FNO:

BLOCK_NUMBER:

ROW_NUMBER:

DBMS_ROWID:

ROWID_INFO:

Object# is????? :::

||:

TO_CHAR:

CHR:

:

Relative_fno is :::

Block number is :::

Row number is?? :::

a d f a b d b

: a c a a a a c

b a a c b a

a c b a a c

b a a c b a a

c b : a b : a a

a e e : a a b b e

e a a b b e e

e b e e : a a b b

e e a a b b e

e e b e e : a a b

b e e a a b b

e e e b e e : a a

b b e d : a b a

b f d b

f e b b

c b

c

d c a c

a c b b bc dd

cc d d c e e eb

ef f f fb ff

d d e

d

c a e

b e

e c f

a b a

b d e a a ab ac b

b b bc bd bf c c c

cd d d d db dd e ed

ef f f

a d : :

: e : e : : d :

: : : f : : f : : d

: d b

: e : : c

e : e : :

: : d f : f

: : :

: d f : f :

: : : :

:

: : :

: : : :

: : : a :b c

: d e : d : e

: d : e : d e

f : d : f : d

: f : d f

: d : : d :

: b :

fb

: :

:a e :

:

: :

: :

:

e a

: b

:

: d f

:

c :

f d

: :

c

:

: : c

a c

a : c

:

e : f

c b

: :

:

c c :

e : :

: b

c d

: f : c

d :

: a :

b : c :

d : e

: a

: :

: : a

: c a c

e e :

: :

:

: :

:

: :

: b :

c e b b

: :

: :

e

:

: :

b :

: : c

: e

d :

: :

: b

d

: :

: b d

: :

: d :

f

:

a :

: :

a d :

d c d c

a b : e

: a d

: e

:

:

e

c

d

f

b

d

f

d a f

a

f c

a

c

e

b

a

c

d

/

測(cè)試加密后的代碼

[oracle@jumper tools]$ exit

exit

SQL drop function get_rowid;

Function dropped

SQL @f_get_rowid plb

Function created

SQL select get_rowid( AAABiPAABAAAFRSAAA ) from dual;

GET_ROWID( AAABIPAABAAAFRSAAA )

Object# is????? :

Relative_fno is :

Block number is :

Row number is?? :

lishixinzhi/Article/program/Oracle/201311/18606


網(wǎng)頁(yè)題目:oracle怎么加密 Oracle加密
分享路徑:http://fisionsoft.com.cn/article/hpeogo.html