I have implemented Always Encrypted feature in SQL Server 2016. The CMK is valid for one year. How do I renew it, or extend the validity?
Always encrypted does not check for validity of the CMK certificate explicitly. Always Encrypted treats the CMK certificate purely as (PK, SK) pair. so you can use the expired cert without running into any issues. However, the best practice is to rotate the CMK at regular intervals. Always Encrypted provides a mechanism to rotate CMK without incurring any application downtime. Please read the following official articles for details.
How to do CMK rotation without powershell:
- Provision a new CMK (CMK2) (Create a new Certificate or create a new AKV key)
- Use an appropriate instance of SqlColumnEncryptionStoreProvider.DecryptColumnEncryptionKey(String, String, Byte) method to decrypt your current encrypted CEK (CEK1) value (CekVal1)
- Use an appropriate instance of SqlColumnEncryptionStoreProvider.EncryptColumnEncryptionKey(String, String, Byte) method to encrypt the cek with the new CMK (CMK2) to get new encrypted CEK value (CekVal2).
- Use Create Column Master Key T-SQL to specify the new CMK (CMK2)
- Use Alter Column encryption key T-SQL to ADD CekVal2 to your current CEK (CEK1)
- At this point, your clients will be able to decrypt CEK1 with both CMK1 and CMK2.
- After you have successfully distributed CMK2 to all clients that need it, Use Alter Column encryption key T-SQL to DROP CekVal1 from your current CEK (CEK1)
- After this point, your clients will no longer be able to decrypt CEK1 using CMK1