SQLEKM| Can GUID associated with key be updated with new GUID

BHARDWAJ Bhuvendra 21 Reputation points
2021-05-25T08:38:05.93+00:00

There is one migration activity going on in which we are migrating from one provider to a different provider with different GUID.
Now we need to restore the live data whose key is associated with one GUID.
Is there any way by which GUID of the key can be updated?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,364 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,523 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,525 questions
SQL Server Migration Assistant
SQL Server Migration Assistant
A Microsoft tool designed to automate database migration to SQL Server from Access, DB2, MySQL, Oracle, and SAP ASE.
517 questions
0 comments No comments
{count} votes

Accepted answer
  1. Erland Sommarskog 107.2K Reputation points
    2021-05-28T21:19:26.217+00:00

    Is the guid you are talking about master.sys.asymmetric_keys.cryptographic_provider_guid?

    The only way to change that would be to change the system catalog directly, but I am not going to say how to do that, because it would render you installation unsupported. And most likely it would not work.

    You need to rotate your TDE key. If you don't want to decrypt it before migrating to the new server, you will need to have both providers in installed for this operation.

    With the same caveat as before: I have never worked with EKM. What I'm saying is based on common sense and reading between the lines in the syntax.


5 additional answers

Sort by: Most helpful
  1. way0utwest 81 Reputation points MVP
    2021-06-01T14:03:45.52+00:00

    This is a little confusing, but let me put a few thoughts here, and ask a couple questions.

    For TDE, we do not get to separate the DEK from the database. This is in the database, and has no backup/restore. This cannot be used for other purposes. There is a certificate, which can be in master (sys.certificates) or in an EKM provider. This key is used to encrypt/decrypt the DEK key. If you want to change this certificate to a new one, you perform key rotation. an example here: https://learn.microsoft.com/en-us/azure/azure-sql/database/transparent-data-encryption-byok-key-rotation?tabs=azure-powershell

    This allow you to decrypt the DEK key from EKM A, and then re-encrypt it with EKM B.

    For column level encryption, do you have the key as a certificate in EKM provider A? If so, you would need to decrypt the data or keys in use and re-encrypt them with EKM B in the same manner.

    0 comments No comments