SQL加密数据
精选 转载在网络上发送数据都会发生一些严重的安全问题,网络最大的担忧在于有人可以捕获数据,sqlserver支持采用证书来加密
1.创建证书
create master key encryption by
password = 'administrator123'
--用密码admini--
create certificate c1
encryption by password = 'administrator123'
with subject = 'c1 certificate',
start_date='03/08/2009',
expiry_date = '02/08/2020';
go
2.创建测试表,name字段为要加密的列,数据类型为varbinary
注意:加密的类型必须是varbinary,因为加密的数据是类型varbinary
create table testB(id int identity(1,1),name varbinary(5000))
3.使用加密函数向测试表中写入一条测试数据
insert into testB(name)
select encryptbycert(cert_id('c1'),'test')
4.利用下面的语句来提取加密数据
select * from testB
5.利用以下语句来解密数据
select id ,cast(decryptbycert(cert_id('c1'),name ,
N'administrator123')as varchar(20)) from testB
上一篇:探测操作系统
下一篇:利用BIOS恢复电池续航时间
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
SpringBoot实现数据源加密
SpringBoot数据源加密最简单的办法
数据源 java springboot 数据源加密 -
SQL Server 数据加密技
数据用数字方式存储在服务器中并非万无一失。实践证明有太多的方法可以智取SQL Ser
sql 主密钥 数据库 数据 非对称