SQL Server中用于Web应用程序的数据库数据加密

时间:2015-09-14 07:22:19

标签: sql-server sql-server-2008 encryption sql-server-2005

我试图以加密格式保存数据库表中的数据,以隐藏数据库表中的数据存储以供用户读取

我是如何在应用程序级别上花费大量精力并在应用程序端减少开销的情况下做到这一点的?

1 个答案:

答案 0 :(得分:1)

阅读此MS SQL Server Encryption Hierarchy

例如:

-- Open the symmetric key with which to encrypt the data.
OPEN SYMMETRIC KEY SSN_Key_01
   DECRYPTION BY CERTIFICATE HumanResources037;

-- Encrypt the value in column NationalIDNumber with symmetric key
-- SSN_Key_01. Save the result in column EncryptedNationalIDNumber.
UPDATE HumanResources.Employee
SET EncryptedNationalIDNumber
    = EncryptByKey(Key_GUID('SSN_Key_01'), NationalIDNumber);

MSDN EcryptionByKey syntax