SQL SERVER 2008 使用TDE加密和解密
SQL SERVER 2008 加密和解密,这样的文件在互联网上不胜枚举,本文的寓意还是一样,一为记录,二可以为开发者提供在实现过程中的注意事项。
TDE: Transparent data encryption is the new database-level encryption feature introduced in SQL Server 2008
加密(详细点击)
1. If it does not already exist, create a database master key (DMK) for the master database. Ensure that the database master key is encrypted by the service master key (SMK). CREATE MASTER KEY ENCRYPTION BY PASSWORD = ‘some password’; 2. Either create or designate an existing certificate for use as the database encryption key (DEK) protector. For the best security, it is recommended that you create a new certificate whose only function is to protect the DEK. Ensure that this certificate is protected by the DMK. CREATE CERTIFICATE tdeCert WITH SUBJECT = ‘TDE Certificate’; 3. Create a backup of the certificate with the private key and store it in a secure location. (Note that the private key is stored in a separate file—be sure to keep both files). Be sure to maintain backups of the certificate as data loss may occur otherwise. BACKUP CERTIFICATE tdeCert TO FILE = ‘path_to_file’ WITH PRIVATE KEY ( FILE = ‘path_to_private_key_file’, ENCRYPTION BY PASSWORD = ‘cert password’); 4. Optionally, enable SSL on the server to protect data in transit. Perform the following steps in the user database. These require CONTROL permissions on the database. 5. Create the database encryption key (DEK) encrypted with the certificate designated from step 2 above. This certificate is referenced as a server certificate to distinguish it from other certificates that may be stored in the user database. CREATE DATABASE ENCRYPTION KEY WITH ALGORITHM = AES_256 ENCRYPTION BY SERVER CERTIFICATE tdeCert 6. Enable TDE. This command starts a background thread (referred to as the encryption scan), which runs asynchronously. ALTER DATABASE myDatabase SET ENCRYPTION ON
简而言之,就是先创建自己的Master key, 然后创建CERTIFICATE证书,然后备份证书,接着关联Master Key 和CERTIFICATE,然后就是设置数据库SET ENCRYPTION ON.
按照步骤下来,你就可以利用下面的这段话来看,是否加密成功。当然,你也可以一开始就去先做判断。
---查看db_name是否加密,------------
---- is_encrypted=1表示加密---------
---- is_encrypted=0表示未加密-------
SELECT is_encrypted FROM sys.databases
WHERE name ='db_name'
解密:
ALTER DATABASE db_name;
SET ENCRYPTION OFF;
GO
/* Wait for decryption operation to complete, look for a
value of 1 in the query below. */
SELECT encryption_state
FROM sys.dm_database_encryption_keys;
GO
USE db_name;
GO
DROP DATABASE ENCRYPTION KEY;
GO
在删除Master key的时候,首先要设置SET ENCRYPTION OFF,然后使用DROP DATABASE ENCRYPTION KEY删除,如果数据库的数据或是结构有变化的话,SQL Management Studio会提示让你去备份数据库日志文件Backup log AdventureWorks2012 set disk="物理地址"。
OK
完成之后,在SQL Management Stud中测试时,无论附加还是还原,需要注意的是,这里如果有了3241,我们仍然可以使用SQL Script的方式进行测试。
SQL SERVER 2008 使用TDE加密和解密的更多相关文章
- SQL Server 2008, 2008 R2, 2012 and 2014 完全支持TLS1.2加密传输
SQL Server 2008, 2008 R2, 2012 and 2014 完全支持TLS1.2加密传输 微软高兴地宣布所有主流SQL Server客户端驱动和SQL Server发行版已经支持T ...
- 在SQL Server 2008中执行透明数据加密
问题 安全是任何公司的一个主要考量.数据库备份容易被偷并被恢复到另一个SQL Server实例上.当我们浏览SQL Server 2008的新特性时,我们对一个叫做透明数据加密的特性很感兴趣,我们可以 ...
- SQL Server 2008连接字符串写法大全
一..NET Framework Data Provider for SQL Server 类型:.NET Framework类库使用:System.Data.SqlClient.SqlConnect ...
- SQL Server 2008连接字符串写法大全{转}
一..NET Framework Data Provider for SQL Server 类型:.NET Framework类库使用:System.Data.SqlClient.SqlConnect ...
- SQL Server 2008连接字符串写法大全(摘自网络)
一..NET Framework Data Provider for SQL Server 类型:.NET Framework类库使用:System.Data.SqlClient.SqlConnect ...
- 《SQL Server 2008从入门到精通》--20180716
1.锁 当多个用户同时对同一个数据进行修改时会产生并发问题,使用事务就可以解决这个问题.但是为了防止其他用户修改另一个还没完成的事务中的数据,就需要在事务中用到锁. SQL Server 2008提供 ...
- SQL Server 2008安全加固手册
1.身份鉴别 1.1避免使用空密码和弱口令 要求:应对登录操作系统和数据库系统的用户进行身份标识和鉴别. 目的:操作系统和数据库系统管理用户身份鉴别信息应具有不易被冒用的特点,口令应有复杂度要求并定期 ...
- 利用SQL Server 2008 R2创建自动备份计划
本文主要利用SQL Server 2008 R2自带的"维护计划"创建一个自动备份数据的任务. 首先,启动 Sql Management studio,确保"SQL Se ...
- SQL Server 2008 阻止保存要求重新创建表的更改问题的设置方法
不是很理解为什么在2008中会加入阻止保存要求重新创建表的更改这个选项.症状表现为修改表结构的时候会"阻止"你.而且我遇到的情况是居然有的时候阻止你,有的时候不阻止你,摸不到头脑. ...
随机推荐
- 【转】C++中的虚函数的实现
转自:http://blog.csdn.net/haoel/article/details/1948051 对C++ 了解的人都应该知道虚函数(Virtual Function)是通过一张虚函数表(V ...
- IMP 导入数据报错 OCI-21500 OCI-22275
IMP导入数据报错如下: OCI-21500: internal error code, arguments: [kgepop: no error frame to pop to], [], [], ...
- [HTTP2] HTTP1 probs and HTTP2 saves
1. HOL (HEADS of LINE BLOCKING) Too many requests in the header tag. Broswer can allow 6 reuqest to ...
- careercup-排序和查找 11.5
11.5 有个排序后的字符串数组,其中散布着一些空字符串,编写一个方法,找出给定字符串的位置. 解法: 如果没有那些空字符串,就可以直接使用二分查找法.比较待查找字符串str和数组的中间元素,然后继续 ...
- WWDC2016 Session笔记 – Xcode 8 Auto Layout新特性
目录 1.Incrementally Adopting Auto Layout 2.Design and Runtime Constraints 3.NSGridView 4.Layout Feedb ...
- Java基础知识强化之IO流笔记58:内存操作流
1. 内存操作流: 用来操作处理临时存储的信息的. (1)操作字节数组: ByteArrayInputStream ByteArrayOutputStream 代码示例: package cn.itc ...
- 搭建FTP+PAM+MySQL环境
搭建FTP+PAM+MySQL环境 1 搭建环境: CentOS6.5或CentOS6.7 [root@vhost3 ~]# uname -a Linux vhost3 -.el6.x86_64 # ...
- hibernate篇章三-- hibernate配置文件hibernate.cfg.xml的详细解释
<!--标准的XML文件的起始行,version='1.0'表明XML的版本,encoding='gb2312'表明XML文件的编码方式--> <?xml version='1.0' ...
- jBPM5 vs Actitivi
http://www.blogways.net/blog/2013/07/16/activiti-jbpm-compare.html jBPM是目前市场上主流开源工作引擎之一,在创建者Tom Baey ...
- 如何创建windows xp 虚拟机
如何创建windows xp 虚拟机 一.所需软件 1. VMware-workstation-full-12.0.0-2985596 赠送vm12 激活key一枚: 5A02H-AU243 ...