How can I encrypt the data using DMK?
According to BOL, I don’t have to open that key, but somehow have to pass
something to: EncryptByKey function. How?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The DMK is not for your own use. Is used to encrypt other keys (via
ALTER ... ADD ENCRYPTION BY MASTER KEY), but never your data. This is a requirement, since the DMK can change and when such change happens all keys encrypted with DMK have to re-encrypted with the new DMK. The engine knows how to find the keys encrypted with the DMK, but it would be impossible to locate the data encrypted with DMK and a DMK rotation would leave such data ‘perfectly encrypted’ (ie. undecryptable, the key was lost).