本文介绍了备份加密密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我们如何使用T-SQL创建Symmetic和Asymmetric Keys的备份?

How we create backup of Symmetic and Asymmetric Keys using T-SQL?

谢谢,

Ashru

MCTS,http://asharafaliptb.wordpress.com

MCTS, http://asharafaliptb.wordpress.com

推荐答案

您无法备份非对称密钥!

http://www.sqlservercentral.com/blogs/ steve_jones / 2009/05/04 / backup-up-asymmetric-keys /

http://www.sqlservercentral.com/blogs/steve_jones/2009/05/04/backing-up-asymmetric-keys/

CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'My p@55w0Rd';
GO
CREATE CERTIFICATE [cert_keyProtection] WITH SUBJECT = 'Key Protection';
GO
CREATE SYMMETRIC KEY [key_DataShare] WITH
    KEY_SOURCE = 'My key generation bits. This is a shared secret!',
    ALGORITHM = AES_256,
    IDENTITY_VALUE = 'Key Identity generation bits. Also a shared secret'
    ENCRYPTION BY CERTIFICATE [cert_keyProtection];
GO

打开对称密钥

OPEN SYMMETRIC KEY [key_DataShare]
    DECRYPTION BY CERTIFICATE cert_keyProtection;
GO
SELECT encryptbykey(key_guid('key_DataShare'), 'MyData' )
GO
-- For example, the output might look like this: 0x2152F8DA8A500A9EDC2FAE26D15C302DA70D25563DAE7D5D1102E3056CE9EF95CA3E7289F7F4D0523ED0376B155FE9C3

参考
更多信息。


这篇关于备份加密密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 18:12