views:

31

answers:

1

Hello,

I am just curious if someone can get me pointed in the right direction with searching MySQL with AES encryption.

There are a couple of things that need to be considered. If I take the keyword and encrypt it before searching, i'm comparing encryption to encryption and even if one letter is cap and another letter isn't cap inside MySQL then it won't find it using the LIKE %$keyword%

The other factor is my process of encryption. $variable -> clean-up extra spacing -> strip_slashes (etc) -> Convert to AES -> Convert to Base_64 before importing to DB.

The reason for the extra encoding was issues with abstract characters going into MySQL and this was a flawless import using this. So using MySQL AES built in, wasn't the best option for me.

So I'm guessing that the best route to do this is something along these lines.

$variable -> [keyword] Do a sql results decrypt it and search the string? but that seems kind of overkill...

Perhaps someone can shed some light onto this for me, I would be surely grateful.

Cheers! and thanks in advance!

A: 

If you have encrypted the data before inserting it, there is no way to search partial values at all except to iterate each row, decrypt it, and search the result.

Andrew Barber
What do you think about the comment I added above to my question?
Justin