当前位置:网站首页>sqlserver对数据进行加密、解密
sqlserver对数据进行加密、解密
2022-07-04 21:37:00 【CodingSir】
– sqlserver对数据进行加密、解密
– 创建测试表
CREATE TABLE TBLUser
(
Name nvarchar(30),
Password varbinary(1000)
)
- 1
- 2
- 3
- 4
- 5
– 创建数据库主**
CREATE master key ENCRYPTION BY PASSWORD ='[email protected]'
- 1
– 创建证书
CREATE CERTIFICATE TestCert with SUBJECT = 'Test Certificate'
- 1
– 创建对称**
CREATE SYMMETRIC KEY TestSymmetric WITH ALGORITHM = AES_256 ENCRYPTION BY CERTIFICATE TestCert
- 1
– 使用对称秘钥加密数据
OPEN SYMMETRIC KEY TestSymmetric DECRYPTION BY CERTIFICATE TestCert;
INSERT INTO TBLUser values('张三', ENCRYPTBYKEY(Key_Guid(N'TestSymmetric'), '123456'));
CLOSE SYMMETRIC KEY TestSymmetric;
- 1
- 2
- 3
– 查看加密后的数据
SELECT * FROM TBLUser
- 1
– 解密数据
OPEN SYMMETRIC KEY TestSymmetric DECRYPTION BY CERTIFICATE TestCert;
SELECT Name, CAST(DecryptByKey(password) as varchar(100)) Password FROM TBLUser;
CLOSE SYMMETRIC KEY TestSymmetric;边栏推荐
- [early knowledge of activities] list of recent activities of livevideostack
- 湘江鲲鹏加入昇腾万里伙伴计划,与华为续写合作新篇章
- What is the stock account opening process? Is it safe to use flush mobile stock trading software?
- 置信区间的画法
- 股票开户流程是什么?使用同花顺手机炒股软件安全吗?
- MongoDB聚合操作总结
- Hash table
- Exclusive interview of open source summer | new committer Xie Qijun of Apache iotdb community
- 玩转gRPC—深入概念与原理
- 解决异步接口慢导致的数据错乱问题
猜你喜欢

QT—绘制其他问题

如何借助自动化工具落地DevOps
![[leetcode] 17. Letter combination of telephone number](/img/be/7f456c092f7cda5ebabc2f1cce292e.png)
[leetcode] 17. Letter combination of telephone number

bizchart+slider实现分组柱状图

TCP protocol three times handshake process

做BI开发,为什么一定要熟悉行业和企业业务?

TCP shakes hands three times and waves four times. Do you really understand?

保证接口数据安全的10种方案

Three or two things about the actual combat of OMS system

DevEco Device Tool 3.0 Release带来5大能力升级,让智能设备开发更高效
随机推荐
Golang interview finishing three resumes how to write
# 2156. Find the substring of the given hash value - post order traversal
1807. Replace the parentheses in the string
Redis 排查大 key 的3种方法,优化必备
并列图的画法,多排多列
Interview question 01.01 Determine whether the character is unique
Open3d surface normal vector calculation
Is it safe to open an account in the stock of Caicai college? Can you only open an account by digging money?
机器学习笔记 - 互信息Mutual Information
How to remove the black dot in front of the title in word document
Nat. Commun.| 机器学习对可突变的治疗性抗体的亲和力和特异性进行共同优化
[leetcode] 17. Letter combination of telephone number
Delphi soap WebService server-side multiple soapdatamodules implement the same interface method, interface inheritance
KDD2022 | 什么特征进行交互才是有效的?
WebGIS框架---kalrry
2022 version of stronger jsonpath compatibility and performance test (snack3, fastjson2, jayway.jsonpath)
B站大量虚拟主播被集体强制退款:收入蒸发,还倒欠B站;乔布斯被追授美国总统自由勋章;Grafana 9 发布|极客头条
MongoDB聚合操作总结
Bookmark
Three or two things about the actual combat of OMS system