On Pinal Dave's blog he gives a simple tutorial for creating a database master key (protected with a password), a certificate and a symmetric key:
CREATE CERTIFICATE EncryptTestCert WITH SUBJECT = 'SQLAuthority';
CREATE SYMMETRIC KEY TestTableKey WITH ALGORITHM = TRIPLE_DES ENCRYPTION BY CERTIFICATE EncryptTestCert;
He then shows the encrypted data...
...and states that
hackers will not be able to make use of it even if they somehow manage to reach the data.
Now I assume that the database master key is stored within the respective database? If so, if a hacker downloads the entire database, or gains access to the server, if the DMK is protected via a password, can't the hacker just use the same code Pinal Dave does to decrypt it? e.g.
OPEN SYMMETRIC KEY TestTableKey DECRYPTION BY CERTIFICATE EncryptTestCert;
SELECT CONVERT(VARCHAR(50),DECRYPTBYKEY(EncryptSecondCol)) AS DecryptSecondCol
FROM TestTable;
If so, what is the correct way to mimic a database on a second server via password encryption, without affecting any service master key settings?