标签云
asm恢复 bbed bootstrap$ dul In Memory kcbzib_kcrsds_1 kccpb_sanity_check_2 kfed MySQL恢复 ORA-00312 ORA-00607 ORA-00704 ORA-01110 ORA-01555 ORA-01578 ORA-08103 ORA-600 2131 ORA-600 2662 ORA-600 2663 ORA-600 3020 ORA-600 4000 ORA-600 4137 ORA-600 4193 ORA-600 4194 ORA-600 16703 ORA-600 kcbzib_kcrsds_1 ORA-600 KCLCHKBLK_4 ORA-15042 ORA-15196 ORACLE 12C oracle dul ORACLE PATCH Oracle Recovery Tools oracle加密恢复 oracle勒索 oracle勒索恢复 oracle异常恢复 Oracle 恢复 ORACLE恢复 ORACLE数据库恢复 oracle 比特币 OSD-04016 YOUR FILES ARE ENCRYPTED 勒索恢复 比特币加密文章分类
- Others (2)
- 中间件 (2)
- WebLogic (2)
- 操作系统 (102)
- 数据库 (1,674)
- DB2 (22)
- MySQL (73)
- Oracle (1,536)
- Data Guard (52)
- EXADATA (8)
- GoldenGate (22)
- ORA-xxxxx (159)
- ORACLE 12C (72)
- ORACLE 18C (6)
- ORACLE 19C (14)
- ORACLE 21C (3)
- Oracle 23ai (7)
- Oracle ASM (67)
- Oracle Bug (8)
- Oracle RAC (52)
- Oracle 安全 (6)
- Oracle 开发 (28)
- Oracle 监听 (28)
- Oracle备份恢复 (562)
- Oracle安装升级 (92)
- Oracle性能优化 (62)
- 专题索引 (5)
- 勒索恢复 (78)
- PostgreSQL (18)
- PostgreSQL恢复 (6)
- SQL Server (27)
- SQL Server恢复 (8)
- TimesTen (7)
- 达梦数据库 (2)
- 生活娱乐 (2)
- 至理名言 (11)
- 虚拟化 (2)
- VMware (2)
- 软件开发 (37)
- Asp.Net (9)
- JavaScript (12)
- PHP (2)
- 小工具 (20)
-
最近发表
- GoldenGate 19安装和打patch
- dd破坏asm磁盘头恢复
- 删除asmlib磁盘导致磁盘组故障恢复
- Kylin Linux 安装19c
- ORA-600 krse_arc_complete.4
- Oracle 19c 202410补丁(RUs+OJVM)
- ntfs MFT损坏(ntfs文件系统故障)导致oracle异常恢复
- .mkp扩展名oracle数据文件加密恢复
- 清空redo,导致ORA-27048: skgfifi: file header information is invalid
- A_H_README_TO_RECOVER勒索恢复
- 通过alert日志分析客户自行对一个数据库恢复的来龙去脉和点评
- ORA-12514: TNS: 监听进程不能解析在连接描述符中给出的SERVICE_NAME
- ORA-01092 ORA-00604 ORA-01558故障处理
- ORA-65088: database open should be retried
- Oracle 19c异常恢复—ORA-01209/ORA-65088
- ORA-600 16703故障再现
- 数据库启动报ORA-27102 OSD-00026 O/S-Error: (OS 1455)
- .[metro777@cock.li].Elbie勒索病毒加密数据库恢复
- 应用连接错误,初始化mysql数据库恢复
- RAC默认服务配置优先节点
标签归档:加密
通过DBMS_CRYPTO包对表敏感字段进行加密
在安全越来越重视的近体,我们不少时候需要对数据库中的某个表的敏感列数据(银行卡,身份证号码,金额等)进行加密,方式数据泄密,在11.2.0.4中可以通过dbms_crypto包方式实现,增加oracle的加密效率,本文提供处理思路,其他可以根据需求尽情发挥
数据库版本
SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production PL/SQL Release 11.2.0.4.0 - Production CORE 11.2.0.4.0 Production TNS for Linux: Version 11.2.0.4.0 - Production NLSRTL Version 11.2.0.4.0 - Production [/shell] <strong>创建加密函数</strong> 1 SQL> create or replace function f_Encrypt_number(number_in in varchar2) return raw is 2 number_in_raw RAW(128):=UTL_I18N.STRING_TO_RAW(number_in,'AL32UTF8'); 3 key_number number(32):=32432432343243279898; 4 key_raw RAW(128):=UTL_RAW.cast_from_number(key_number); 5 encrypted_raw RAW(128); 6 begin 7 encrypted_raw:=dbms_crypto.Encrypt(src=>number_in_raw,typ=>DBMS_CRYPTO.DES_CBC_PKCS5,key=>key_raw); 8 return encrypted_raw; 9 end; 10 / Function created.
测试加密函数
SQL> select f_Encrypt_number('wwww.xifenfei.com') from dual; F_ENCRYPT_NUMBER('WWWW.XIFENFEI.COM') -------------------------------------------------------------------------------- 003CB89CB77F6644C93AE2CF7810B0E3E3B10B8C60B54058
创建解密函数
SQL> create or replace function f_decrypt_number (encrypted_raw IN RAW) 2 return varchar2 is 3 decrypted_raw raw(48); 4 key_number number(32):=32432432343243279898; 5 key_raw RAW(128):=UTL_RAW.cast_from_number(key_number); 6 begin 7 decrypted_raw := DBMS_CRYPTO.DECRYPT 8 ( 9 src => encrypted_raw, 10 typ => DBMS_CRYPTO.DES_CBC_PKCS5, 11 key => key_raw 12 ); 13 return UTL_I18N.RAW_TO_CHAR (decrypted_raw, 'AL32UTF8'); 14 END; 15 / Function created.
测试解密函数
SQL> select f_decrypt_number('003CB89CB77F6644C93AE2CF7810B0E3E3B10B8C60B54058') from dual; F_DECRYPT_NUMBER('003CB89CB77F6644C93AE2CF7810B0E3E3B10B8C60B54058') -------------------------------------------------------------------------------- wwww.xifenfei.com
创建表综合测试
SQL> create table xifenfei_crypto 2 (id number, name varchar2(20),en_name raw(128)) ; Table created. SQL> insert into xifenfei_crypto (id,name) select object_id,object_name from dba_objects where rownum<10; 9 rows created. SQL> commit; Commit complete. SQL> select * from xifenfei_crypto; ID NAME EN_NAME ---------- -------------------- ------------------------------ 20 ICOL$ 46 I_USER1 28 CON$ 15 UNDO$ 29 C_COBJ# 3 I_OBJ# 25 PROXY_ROLE_DATA$ 41 I_IND1 54 I_CDEF2 9 rows selected. SQL> update xifenfei_crypto set en_name=f_Encrypt_number(name); 9 rows updated. SQL> commit; Commit complete. SQL> select * from xifenfei_crypto; ID NAME EN_NAME ---------- -------------------- -------------------------------------------------- 20 ICOL$ FE17B031331839A9 46 I_USER1 FEF96765B1E2C53C 28 CON$ 0283FCE900ACED5C 15 UNDO$ 20DD92762F199436 29 C_COBJ# A0CB43E2EA6BA889 3 I_OBJ# F2DE1B9C8A39AA3D 25 PROXY_ROLE_DATA$ 62B99C02EBD4B250311E4490207FEF18CBD8CD8FBA1BFD81 41 I_IND1 3F4C3C186F8E2F52 54 I_CDEF2 CA23D202802BD3AC 9 rows selected. SQL> select id,name,f_decrypt_number(EN_NAME) de_name,en_name from xifenfei_crypto; ID NAME DE_NAME EN_NAME ---------- -------------------- ------------------------------ -------------------------------------------------- 20 ICOL$ ICOL$ FE17B031331839A9 46 I_USER1 I_USER1 FEF96765B1E2C53C 28 CON$ CON$ 0283FCE900ACED5C 15 UNDO$ UNDO$ 20DD92762F199436 29 C_COBJ# C_COBJ# A0CB43E2EA6BA889 3 I_OBJ# I_OBJ# F2DE1B9C8A39AA3D 25 PROXY_ROLE_DATA$ PROXY_ROLE_DATA$ 62B99C02EBD4B250311E4490207FEF18CBD8CD8FBA1BFD81 41 I_IND1 I_IND1 3F4C3C186F8E2F52 54 I_CDEF2 I_CDEF2 CA23D202802BD3AC 9 rows selected.