Filter by encrypted attribute
I am storing some personal information (national identification numbers,), and encrypting it with
ash_cloak
. I'd like to implement an action where I search for users given a national identification number as an argument. With the filter
I get this error:
Is there any way to accomplish this?3 Replies
You should be able to do something like this:
After messing with it for a bit I ended up with this:
However I realized that I'm encrypting with a new random IV every time, so it won't work. I'll have to think about it, I suppose the options are
1. Drop the search
2. Decrypt the field for each record every time a search is run
3. Use a deterministic encryption
4. Drop the encryption
Yeah that makes sense. It's not realistic to filter otherwise, unless you use encryption designed to work that way
There are some things that work directly in the db that support filtering I think