Skip to content

Conversation

@coderdan
Copy link
Contributor

@coderdan coderdan commented Oct 30, 2024

Summary

Changes

Adds "via" dataset variants of entry points to the EncryptedTable. These methods allow for the selection of a specific dataset before performing an operation.

  • EncryptedTable::put is as before and uses the default dataset for the client
  • EncryptedTable::put_via allows a dataset to be specified via its id (uuid)
  • Similar methods have been added for get and delete
  • The QueryBuilder has been given a via builder method to provide a specific dataset to use during queries

The decrypt_all method has not been modified as decryption operations will use the dataset ID encoded into the ciphertext payload (AAD) to determine which dataset was used to encrypt. If the client does not have access to any dataset associated with a record passed to decrypt_all, the operation will fail.

This uses the pre-release version of cipherstash-client, 0.13.0-pre.1.

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@coderdan coderdan force-pushed the feat/per-dataset-ops branch 2 times, most recently from 3a80862 to 45bf2e1 Compare October 30, 2024 22:48
@coderdan coderdan force-pushed the feat/per-dataset-ops branch from bd9437c to 5245226 Compare October 31, 2024 10:57
@coderdan coderdan marked this pull request as ready for review October 31, 2024 11:15
@freshtonic
Copy link
Contributor

Does this mean different records in the same EncryptedTable could have been encrypted with different encryption keys, and does decryption handle that gracefully?

Copy link
Contributor

@freshtonic freshtonic left a comment

Choose a reason for hiding this comment

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

This looks really good - nice work.

I answered my own question around the decryption after I read the code. My understanding is that if multiple records in a table are encrypted via different datasets, they will not decrypt unless decrypted via the same dataset ID that they were encrypted with, and that is handled gracefully.

@coderdan
Copy link
Contributor Author

coderdan commented Nov 1, 2024

This looks really good - nice work.

I answered my own question around the decryption after I read the code. My understanding is that if multiple records in a table are encrypted via different datasets, they will not decrypt unless decrypted via the same dataset ID that they were encrypted with, and that is handled gracefully.

Thanks, @freshtonic. Yep, that's correct!

@coderdan coderdan merged commit d766093 into main Nov 1, 2024
3 checks passed
@coderdan coderdan deleted the feat/per-dataset-ops branch November 1, 2024 02:59
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.

3 participants