How to periodically change the symmetric key and certificate for a encrypted database in SQL Server? Encryption logic is Database Master Key -> Certificate -> Symmetric Key -> Decrypted Data. I would like to periodically change certificates / symmetric keys to ensure the symmetric keys / certificate is safe.
4
votes
1 Answers
1
votes
If you're using TDE:
ALTER DATABASE ENCRYPTION KEY
REGENERATE WITH ALGORITHM = AES_256
ENCRYPTION BY SERVER ASYMMETRIC KEY your_key_encryption_key
will do the trick.
If your data is encrypted at the column level, you'll have to cycle through every row and update each with ENCRYPTBYKEY(key_guid('new_key'), DECRYPTBYKEY(data))
.
SELECT
you would have issues when decrypting the data (unless you decrypt all data and then re-encrypt it using the new key). Generally these keys do not leave your database which are housed in secure location. – ughai