I have some database columns which are encrypted. Obviously there is no way to filter these by plaintext value. As the data stored in the db is ~~salted~~ combined with the IV, there is no way to recreate the cypher text.
The value in the database is created like so:
db_value = base64(json([iv, cypher, mac]))
...so without the IV, I can't create db_value
. And I can't find the IV without reading db_value.
I could get around this by creating another column to store a hash of the data.
Is this a bad idea? Would keeping the data in multiple formats like this make it less secure?