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

Add deterministic encryption #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add deterministic encryption #2

wants to merge 4 commits into from

Conversation

whs
Copy link

@whs whs commented Jun 7, 2022

This PR refactors the base key management into a separate class, and add Deterministic AEAD

@whs
Copy link
Author

whs commented Jun 8, 2022

Added more fixes in 00a42ae. I'm implementing a keyset store with Django models (maybe another PR once I've finished) and found the need to backports some changes:

  • Wrapping lru_cache on instance methods retain the instance. To not ship another implementation Django's cached_property decorator is used instead. Unfortunately this result in API breaking change.
  • Added EncryptedBinaryField. This requires opting out of force_str in decryption routine so it is refactored into to_python_prepare. This field type will be used to store binary keyset.
  • Added test for nullable values. With this test, I found that the previous lookup allowlist use isinstance which does not work for class instances (per the name it only works on instance of the class and not class itself). I'm not sure what to use, but issubclass seems to work. See next comment

@whs
Copy link
Author

whs commented Jun 12, 2022

Turns out searching deterministic encrypted field is harder than I think when key rotation is involved. In 0c2fed6 I instead reimplement the exact operator to be in operator with list of value encrypted with all available keys. This, however make filter(value=None) doesn't work since the in operator eliminate None values. isnull still works though and should be used instead.

@whs whs mentioned this pull request Jun 12, 2022
1 task
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.

None yet

1 participant