Oracle数据加密方法与测试问题记录 下载本文

内容发布更新时间 : 2024/5/17 16:52:45星期一 下面是文章的全部内容请认真阅读。

一、xxx项目数据加密要求: 1、 保密数据密文存储。

2、 支持256位对称加密算法。 3、 本机能正常访问加密库。 4、 应用系统能正常运行。

二、拟采取的解决方案

数据安全常用的解决方案有以下几种: 1、 对数据文件加密

2、 对存储保密数据的磁盘加密 3、 对保密数据本身加密

采用Oracle 的透明数据加密(TDE)技术 概述:

TDE_Key Management Architecture:

alter system set encryption key identified by \

ALTER SYSTEM SET ENCRYPTION WALLET OPEN IDENTIFIED BY \

ALTER SYSTEM SET ENCRYPTION WALLET CLOSE IDENTIFIED BY \对表空间需加上密码

三、测试步骤

1

1、准备测试系统

? 在Oracle 11g上配置xxx项目数据库 ? 应用系统能正常运行

2、需要知道

? 数据库服务器机器名、IP

? Oracle DB的DBA的用户名/密码 ? 加密库的表空间、用户名/密码 ? 加密库建库脚本

? 加密库需要加密的各个表、字段说明,标出数据类型、外键和索引。

3、测试策略

? 先选择“组织机构表”进行局部测试,观察数据加密后对整个应用系统的影响 ? 再对业务表进行加密

5、 测试步骤

? Initialize the master key

? SQL> alter system set key identified by “password”; ? Open the Oracle Wallet

? Changing the Master Key:SQL> alter system set key identified by “password”; ? Changing the Wallet Password

? Identify the sensitive data to encrypt

? 选择要加密的数据

? Verify TDE supports the data type and check foreign key usage

? 检查加密列的数据类型是否可以? ? 外键不能加密

? Encrypt the sensitive data using TDE

? SQL> alter table customers modify (credit_card encrypt);

? SQL> create table billing_information ( first_name varchar2(40) ,last_name

varchar2(40) ,card_number varchar2(19) encrypt using 'AES256'); ? SQL> create index cust_idx on customers (credit_card);

? When an indexed column is to be encrypted, it is recommended to first drop the

existing index, encrypt the column, and lastly re-build the index.

? Changing the Table/Column Key : SQL> ALTER TABLE employee ENCRYPT USING 'AES128'; ? Best Practices When First Encrypting Data

Oracle recommends creating a new tablespace, moving the application table to the new tablespace, and dropping the old tablespace.

1. Backup your database completely

2. Create a new table space specifying a new data file 3. Encrypt the sensitive column in the original table 4. Repeat step 3 for all tables that contain sensitive columns

5. Move the tables from the original table space into the new table space

2

6. Drop the original table space using the data file option. Optionally, do not use the '... with datafile' option with the 'drop tablespace' command, but use 'shred' or other platform specific commands to securely delete the old data files on the operating system.

6、 表空间加密方法

? 设置主密钥,主密钥存储在wallet中 修改sqlnet.ora文件,设置

ENCRYPTION_WALLET_LOCATION (or WALLET_LOCATION) 参数,例如: ENCRYPTION_WALLET_LOCATION=

(SOURCE=(METHOD=FILE)(METHOD_DATA= (DIRECTORY=/u01/app/oracle/product/11.1.0/db_1/))) 打开wallet

SQL> STARTUP MOUNT;

SQL> ALTER SYSTEM SET ENCRYPTION KEY IDENTIFIED BY password; SQL> ALTER DATABASE OPEN; ? 创建加密表空间 语法: CREATE

[ BIGFILE | SMALLFILE ] { permanent_tablespace_clause | temporary_tablespace_clause | undo_tablespace_clause } ;

加密算法包括:其中可以指定加密算法,也可以不指定加密算法,默认使用AES128算法。 3DES168 AES128 AES192 AES256

例:指定加密算法

CREATE TABLESPACE securespace

DATAFILE ’/home/user/oradata/secure01.dbf’ SIZE 150M

ENCRYPTION USING ’3DES168’ DEFAULT STORAGE(ENCRYPT); 不指定加密算法:

CREATE TABLESPACE securespace2

DATAFILE ’/home/user/oradata/secure01.dbf’ SIZE 150M ENCRYPTION

DEFAULT STORAGE(ENCRYPT); ? 查看表空间是否加密

可以从DBA_TABLESPACES或USER_TABLESPACES的ENCRYPTED 列查看表空间是否加密。 ? 测试记录

3