当前位置:网站首页>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;
边栏推荐
- 使用 BlocConsumer 同时构建响应式组件和监听状态
- Solve the problem of data disorder caused by slow asynchronous interface
- 智洋创新与华为签署合作协议,共同推进昇腾AI产业持续发展
- Machine learning notes mutual information
- 解决异步接口慢导致的数据错乱问题
- odps 中 对表进行了一次备份,为什么在元数据库查m_table 时,两张表的逻辑大小不一致,但数
- Deveco device tool 3.0 release brings five capability upgrades to make intelligent device development more efficient
- 【米哈游2023届秋招】开启【校招唯一专属内推码EYTUC】
- Bookmark
- Is it safe to open an account in the stock of Caicai college? Can you only open an account by digging money?
猜你喜欢
Xiangjiang Kunpeng joined the shengteng Wanli partnership program and continued to write a new chapter of cooperation with Huawei
力扣98:验证二叉搜索树
Deveco device tool 3.0 release brings five capability upgrades to make intelligent device development more efficient
[optimtool.unconstrained] unconstrained optimization toolbox
国产数据库乱象
The use of complex numbers in number theory and geometry - Cao Zexian
VS2019 C# release下断点调试
湘江鲲鹏加入昇腾万里伙伴计划,与华为续写合作新篇章
MongoDB聚合操作总结
HUAWEI nova 10系列发布 华为应用市场筑牢应用安全防火墙
随机推荐
1807. 替换字符串中的括号内容
HBuilder X 常用的快捷键
B站大量虚拟主播被集体强制退款:收入蒸发,还倒欠B站;乔布斯被追授美国总统自由勋章;Grafana 9 发布|极客头条
Use blocconsumer to build responsive components and monitor status at the same time
El tree combined with El table, tree adding and modifying operations
删库不必跑路!详解 MySQL 数据恢复
Relational database
网上开户哪家证券公司佣金最低,我要开户,网上开户安全吗
Locust性能测试 —— 环境搭建及使用
With this PDF, we finally got offers from eight major manufacturers, including Alibaba, bytek and Baidu
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
1807. Replace the parentheses in the string
The drawing method of side-by-side diagram, multi row and multi column
i.MX6ULL驱动开发 | 24 - 基于platform平台驱动模型点亮LED
Bookmark
How to transfer to software testing, one of the high paying jobs in the Internet? (software testing learning roadmap attached)
大厂的广告系统升级,怎能少了大模型的身影
30余家机构联合发起数字藏品行业倡议,未来会如何前进?
Bizchart+slider to realize grouping histogram
QT—双缓冲绘图