I have a permissions issue with regard to using a symmetric key under a specific user name when a stored procedure is executed.
Despite running
GRANT CONTROL ON CERTIFICATE::myCert TO myUser
GRANT VIEW DEFINITION ON SYMMETRIC KEY::myKey TO myUser
I still get the same error:
Cannot find the symmetric key 'myKey', because it does not exist or you do not have permission.
The Master Key, Certificate and Symmetric Key were set under the database the user name relates to.
If I run the SP under Windows Authentication it works fine.
Here's the stored procedure:
OPEN SYMMETRIC KEY myKey DECRYPTION
BY CERTIFICATE myCert
INSERT INTO sp_Password
(billEncryptPassword)
VALUES(ENCRYPTBYKEY(KEY_GUID('myKey'),@billEncryptPassword))
RETURN @@IDENTITY
CLOSE SYMMETRIC KEY myKey
What have I missed?