I've been following the How-to topics from the books online
Creating a Database Master Key protected by a password ( not SMK)
Creating a Certificate protected by the Database Master key ( not specifying password)
Creating a symmetric key protected by the Certificate
Using the symmetric key to encrypt the data
At last I use the following query to read the result
OPEN SYMMETRIC KEY SSN_Key_01
DECRYPTION BY CERTIFICATE HumanResources001
SELECT EncryptedNationalIDNumber AS ‘Encrypted ID Number�
CONVERT (nvarchar, DecryptByKey(EncryptedNationalIDNumber))
AS ‘Decrypted ID Number�/span>
FROM HumanResources.Employee
Of coz, I got the correct result.
What I keep thinking is, During the query, I use the Certificate which is protected by the Database Master key
Why shouldn't I use OPEN MASTER KEY DECRYPTION BY PASSWORD = 'password' before using the certificate to decrypt the symmetric key?
And at the end, when should I use the OPEN MASTER KEY ?