当前位置:网站首页>Sqlserver encrypts and decrypts data
Sqlserver encrypts and decrypts data
2022-07-04 22:13:00 【CodingSir】
– sqlserver Encrypt data 、 Decrypt
– Create test table
CREATE TABLE TBLUser
(
Name nvarchar(30),
Password varbinary(1000)
)
- 1
- 2
- 3
- 4
- 5
– Create database master **
CREATE master key ENCRYPTION BY PASSWORD ='[email protected]'
- 1
– Create certificate
CREATE CERTIFICATE TestCert with SUBJECT = 'Test Certificate'
- 1
– Create symmetry **
CREATE SYMMETRIC KEY TestSymmetric WITH ALGORITHM = AES_256 ENCRYPTION BY CERTIFICATE TestCert
- 1
– Use symmetric secret keys to encrypt data
OPEN SYMMETRIC KEY TestSymmetric DECRYPTION BY CERTIFICATE TestCert;
INSERT INTO TBLUser values(' Zhang San ', ENCRYPTBYKEY(Key_Guid(N'TestSymmetric'), '123456'));
CLOSE SYMMETRIC KEY TestSymmetric;
- 1
- 2
- 3
– View encrypted data
SELECT * FROM TBLUser
- 1
– Decrypt data
OPEN SYMMETRIC KEY TestSymmetric DECRYPTION BY CERTIFICATE TestCert;
SELECT Name, CAST(DecryptByKey(password) as varchar(100)) Password FROM TBLUser;
CLOSE SYMMETRIC KEY TestSymmetric;
边栏推荐
- 【米哈游2023届秋招】开启【校招唯一专属内推码EYTUC】
- 卷积神经网络模型之——LeNet网络结构与代码实现
- 服务线上治理
- ACM Multimedia 2022 | 视觉语言预训练模型中社会偏见的反事实衡量和消除
- How can the advertising system of large factories be upgraded without the presence of large models
- i.MX6ULL驱动开发 | 24 - 基于platform平台驱动模型点亮LED
- 《命令行上的数据科学第二版》校对活动重新启动
- AcWing 2022 每日一题
- leetcode 72. Edit Distance 编辑距离(中等)
- Nat. Commun.| 机器学习对可突变的治疗性抗体的亲和力和特异性进行共同优化
猜你喜欢
TCP协议三次握手过程
QT—绘制其他问题
Cloudcompare & open3d DBSCAN clustering (non plug-in)
Application practice | Shuhai supply chain construction of data center based on Apache Doris
广电五舟与华为签署合作协议,共同推进昇腾AI产业持续发展
[advanced C language] array & pointer & array written test questions
i.MX6ULL驱动开发 | 24 - 基于platform平台驱动模型点亮LED
QT—双缓冲绘图
PMO:比较25种分子优化方法的样本效率
AscendEX 上线 Walken (WLKN) - 一款卓越领先的“Walk-to-Earn”游戏
随机推荐
GTEST from ignorance to proficiency (3) what are test suite and test case
Bookmark
With this PDF, we finally got offers from eight major manufacturers, including Alibaba, bytek and Baidu
Cadre WebGIS - kalrry
Flink1.13 SQL basic syntax (I) DDL, DML
【C语言进阶篇】数组&&指针&&数组笔试题
能源势动:电力行业的碳中和该如何实现?
嵌入式开发:技巧和窍门——提高嵌入式软件代码质量的7个技巧
Which securities company has the lowest Commission for opening an account online? I want to open an account. Is it safe to open an account online
QT - double buffer plot
服务线上治理
Acwing 2022 daily question
[optimtool.unconstrained] unconstrained optimization toolbox
Force buckle 3_ 383. Ransom letter
DevEco Device Tool 3.0 Release带来5大能力升级,让智能设备开发更高效
Why do you have to be familiar with industry and enterprise business when doing Bi development?
QT—绘制其他问题
Implementation rules for archiving assessment materials of robot related courses 2022 version
Enabling digital economy Fuxin software attends the BRICs high level Forum on Sustainable Development
傳智教育|如何轉行互聯網高薪崗比特之一的軟件測試?(附軟件測試學習路線圖)