Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Samples: Adds sample to demonstrate reencryption using Always Encrypted Cosmos SDK. #2825

Merged
merged 63 commits into from
Jan 7, 2022

Conversation

kr-santosh
Copy link
Contributor

@kr-santosh kr-santosh commented Oct 27, 2021

Description

Sample/Driver - demonstrates, how reencryption of encrypted data in Cosmos DB can be carried out using Always Encrypted CosmosDB SDK (Client-Side encryption). This can be used to change/rotate data encryption keys or change the client encryption policy.

Initially there will be no support for reencrypting the data when there are active changes taking place in the source containers, so the flag IsFFChangeFeedSupported(in Constants.cs file) value has been set to false. Full Fidelity change feed is in Preview mode and has to be enabled on an account to use the feature. This allows for reencryption
to be carried out, when the source container is still receiving changes. This can be set to true when the feature is available or is enabled on the account.

Type of change

  • [] New feature (non-breaking change which adds functionality)
  • [] This change requires a documentation update

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

abhijitpai
abhijitpai previously approved these changes Jan 5, 2022
{
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certs = store.Certificates.Find(findType: X509FindType.FindByThumbprint, findValue: clientCertThumbprint, validOnly: false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValidOnly: false might be very liberal (might be okey for testing)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if you want to retrieve only trusted certs. Since here its a sample we are just returning the self signed cert setting true will not return it unless its issuer need to be present in trusted root authority. There are however multiple ways to get the token credentials, can use AD too. This is just an example.


Program.client = Program.CreateClientInstance(configuration, azureKeyVaultKeyStoreProvider);

await Program.CreateAndRunReEncryptionTasks(client);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the client is passed as instance across, is the member state necessary?

document.Remove(Constants.MetadataPropertyName);
document.Remove(Constants.LsnPropertyName);
bulkOperations.Tasks.Add(this.container.UpsertItemAsync(
item: document,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarification:
I guess we do allow changing the 'id' of document part of update, that should flow through good. Do that show-up as update in the change-feed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. We get the entire image.

@j82w j82w dismissed anujtoshniwal’s stale review January 7, 2022 14:15

nits are fixed; out of office

@j82w j82w merged commit ec8b8bb into master Jan 7, 2022
@j82w j82w deleted the users/sakulk/CepCekRotation branch January 7, 2022 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants