Need: I need to be able to store AES encrypted user data (journal entries) in my database and those entries need to be plain-text searchable.
Issue: MySQL outputs queries to its logs in plain text.
History: I've already accomplished the desired behavior by letting MySQL handle encryption and searching with AES_DYCRYPT
and LIKE
, but it means that MySQL is outputting my users' entries along with my AES key in plain text to its logs.
Possible Solution: I've attempted moving my encryption step to the server before sending data to MySQL, but not being able to have the DB handle decryption and therefore plain-text search really complicates things. I don't want to have to pull in all of a specific user's entries and then filter them based on the text query from the server.
Question: How big of a security hole is the fact that MySQL outputs all queries to its logs in plain text when deciding to use MySQL's AES_ENCRYPT
function? Should I just use MySQL's encryption functions so I can also use its LIKE
feature, or should I encrypt on the server and look into other solutions such as storing a hashed word index as a new column so I can still provide some sort of text search?
I should note that I'm using a hosted MySQL solution which, at the price point I'm currently paying, does not allow me to manage admin settings myself. The hosting company has access to the logs.