0

I am trying to use a stored procedure that has encrypted data, I have written the same program in Python with success. However when I use c# connecting to same db, it throws this error. Cannot find the symmetric key 'keyFieldProtection', because it does not exist or you do not have permission.'

1 Answers1

0

You need to grant permissions to the keys. If you are unable to grant permissions, need to switch mode to windows authentication.

Else if you are opening master key, then refer to the following:

https://learn.microsoft.com/en-us/sql/t-sql/statements/open-master-key-transact-sql?redirectedfrom=MSDN&view=sql-server-2017

As per above;

“If the database master key was encrypted with the service master key, it will be automatically opened when it is needed for decryption or encryption. In this case, it is not necessary to use the OPEN MASTER KEY statement.”

Its hard to tell without looking at your code

Gauravsa
  • 6,330
  • 2
  • 21
  • 30