MSSQL数据加密解密代码

溪水很清澈,小鱼小虾都看的一清二楚。你看一群群的小鱼在前面游来游去,那只小虾从石头缝里爬出来向诱饵靠近,还有还有那只红钳子的大虾夹住了诱饵,哦,上钩咯!溪水上的钱币也随着一晃一晃的,星星点点的,投到了水面上,投到了石头上,还投到了我们的身上。夕阳西下暑气渐渐消退,我们也都相伴着回家了,带回去的不仅仅只有那些小虾……
可以查看:
 
OPEN SYMMETRIC KEY 命令关于 对称密钥加密使用证书解密
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'password'
go
CREATE CERTIFICATE CertTest
with SUBJECT = 'Test Certificate'
GO
--创建非对称密钥
CREATE ASYMMETRIC KEY TestAsymmetric
WITH ALGORITHM = RSA_2048
ENCRYPTION BY PASSWORD = 'password1' ;
GO
ALTER ASYMMETRIC KEY TestAsymmetric WITH PRIVATE KEY (DECRYPTION BY PASSWORD = 'password1') --DROP ASYMMETRIC KEY TestAsymmetric
--创建对称密钥
CREATE SYMMETRIC KEY TestSymmetric
WITH ALGORITHM = AES_256
ENCRYPTION BY PASSWORD = 'password' ;
GO OPEN SYMMETRIC KEY TestSymmetric
DECRYPTION BY PASSWORD = 'password' ; go
SELECT ENCRYPTBYASYMKEY(ASYMKEY_ID ('TestAsymmetric'), name) ,
CAST(deCRYPTBYASYMKEY (ASYMKEY_ID( 'TestAsymmetric'),ENCRYPTBYASYMKEY (ASYMKEY_ID( 'TestAsymmetric'),name ) )
as nvarchar(200 )),
ENCRYPTBYCERT ( Cert_ID('CertTest' ),name),
CAST(deCRYPTBYCERT (Cert_ID ('CertTest'), ENCRYPTBYCERT (Cert_ID( 'CertTest'),name ))
as nvarchar (200)),
EncryptByKey ( KEY_GUID('TestSymmetric' ),name),
CAST(decryptByKey (EncryptByKey (KEY_GUID ('TestSymmetric'), name))
as nvarchar (200)) FROM sys .objects

本文MSSQL数据加密解密代码到此结束。是欲望,是理想,是伟大的梦想,充实了我们大脑,每一天,每一点,每一刻,都不能停止前进的脚步,因为为了欲飞就要努力跑,一直不停地向前行,一直走到生命的终结点,也不肯放弃。虽然我们不是鸟,是人,但是我们可以做一只天中的鸟人,鸟人多好,俯视大地,山川美景尽收眼底,那该是那么伟大而自豪的事;在地上,我们只是普普通通的小人,但是我们可以做一个了不起的人物;去认真做一件你没敢实现的大事,那么,成功就在彼岸,你就会因此而变得不平凡。小编再次感谢大家对我们的支持!

您可能有感兴趣的文章
SQLSERVER加密解密函数(非对称密钥证书加密对称密钥)如何使用方法代码

msSQL中having的用处详解

MSSQL批量插入数据优化详细

MSSQLSERVER不同版本设置开启远程连接(sa配置)

Python版Mssql爆破小脚本