当前位置:网站首页>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;边栏推荐
- MongoDB聚合操作总结
- 能源势动:电力行业的碳中和该如何实现?
- How to use concurrentlinkedqueue as a cache queue
- 哈希表(Hash Tabel)
- Case sharing | integrated construction of data operation and maintenance in the financial industry
- 机器学习笔记 - 互信息Mutual Information
- How was MP3 born?
- 机器人相关课程考核材料归档实施细则2022版本
- Three or two things about the actual combat of OMS system
- Exclusive interview of open source summer | new committer Xie Qijun of Apache iotdb community
猜你喜欢
【米哈游2023届秋招】开启【校招唯一专属内推码EYTUC】
![[leetcode] 17. Letter combination of telephone number](/img/be/7f456c092f7cda5ebabc2f1cce292e.png)
[leetcode] 17. Letter combination of telephone number

Nat. Commun.| 机器学习对可突变的治疗性抗体的亲和力和特异性进行共同优化

Sorting and sharing of selected papers, systems and applications related to the most comprehensive mixed expert (MOE) model in history

迷失在Mysql的锁世界

How to use concurrentlinkedqueue as a cache queue

Redis has three methods for checking big keys, which are necessary for optimization

El tree combined with El table, tree adding and modifying operations

VS2019 C# release下断点调试

B站大量虚拟主播被集体强制退款:收入蒸发,还倒欠B站;乔布斯被追授美国总统自由勋章;Grafana 9 发布|极客头条
随机推荐
Redis 排查大 key 的3种方法,优化必备
Learning breakout 3 - about energy
Flutter WebView示例
文件读取写入
HDU - 1078 fatmouse and cheese (memory search DP)
Application practice | Shuhai supply chain construction of data center based on Apache Doris
el-tree结合el-table,树形添加修改操作
AcWing 2022 每日一题
Flutter TextField示例
# 2156. Find the substring of the given hash value - post order traversal
【米哈游2023届秋招】开启【校招唯一专属内推码EYTUC】
Shutter textfield example
NAACL-22 | 在基于Prompt的文本生成任务上引入迁移学习的设置
Interview question 01.08 Zero matrix
New intersectionobserver usage notes
HUAWEI nova 10系列发布 华为应用市场筑牢应用安全防火墙
旋变串判断
Bookmark
赋能数字经济 福昕软件出席金砖国家可持续发展高层论坛
Go language loop statement (3 in Lesson 10)