Skip to main content
Transparent Data Encryption (TDE) in SQL Server utilizes a database encryption key (DEK), a symmetric key that encrypts the data. By default, this DEK is protected by a server certificate (the “software-stored” key) in the master database. However, SQL Server also supports protecting the DEK with an external HSM-managed asymmetric key via Extensible Key Management (EKM). In other words, the DEK can be wrapped by either a certificate or an EKM-backed key. It is indeed possible to switch an existing software-based TDE-enabled database to TDE with EKM. The process simply re-wraps (rotates) the DEK under the new key. Rotating the TDE protector is an online operation that only decrypts and re-encrypts the DEK, not the entire database. This means the data stays encrypted with the same symmetric key, preserving continuity.

Migration Steps

Let’s assume your current database is called legacyDB, and it’s encrypted with a DEK protected by a software certificate (which is SQL Server’s default when TDE is initially enabled). Our goal: rewrap that DEK under EkmAsym without re-encrypting the data.
Before proceeding with the steps below, ensure you have completed the steps outlined in
Here’s the migration procedure:
1
Verify Current Encryption State
Sql
Look for:
  • encryption_state = 3 → means “encrypted”
  • encryptor_type = CERTIFICATE → this confirms it’s using the software certificate
2
Back Up the Current CertificateIt is highly recommended to backup the current certificate in case you need to decrypt older backups:
Sql
Replace YourCurrentTDECert with the actual certificate name from:
Sql
3
Rewrap the DEK with the EkmAsym key created on the KMES through EKM in the Enable TDE in Microsoft SQL Server by using EKM section.
Sql
This rewraps the existing DEK under EkmAsym. SQL Server does not generate a new DEK - it just updates the protector.You can verify the switch by running this command again:
Sql
Expected result:
  • encryption_state = 3 → means “encrypted”
  • encryptor_type = ASYMMETRIC KEY → this confirms it’s using the EKM-stored key