程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> 其他數據庫知識 >> MSSQL >> MSSQL數據加密解密代碼

MSSQL數據加密解密代碼

編輯:MSSQL

MSSQL數據加密解密代碼。本站提示廣大學習愛好者:(MSSQL數據加密解密代碼)文章只能為提供參考,不一定能成為您想要的結果。以下是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
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved