kvesteri / sqlalchemy-utils

Various utility functions and datatypes for SQLAlchemy.
Other
1.25k stars 320 forks source link

[Question] how to search on EncryptedType? #470

Open lefnire opened 4 years ago

lefnire commented 4 years ago

I've read discussions on the various encryption engines, where Fernet & a less-secure AES are useful to preserve searching functionality, where the more-secure AES removes searching functionality. I'll update with that link when I find it.

I'm using Fernet because I do want to preserve search. How do I do that? I've tried .filter_by(text=encrypt(text)) (I'm calling encrypt directly as encrypt = lambda x: MyModel.__table__.columns.text.type.process_result_value(x, "postgresql"). But encrypt(x) is different each time, so this fails.

ryananeff commented 3 years ago

Also interested