1,105,391 Community Members

Wildcard searching of encrypted data in a MySQL database?

Member Avatar
Junior Poster in Training
62 posts since Nov 2012
Reputation Points: 6 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]

Hi everybody,

I am in the process of building a small web application which will hold around 10 pieces of information for every person inserted. Due to data protection the majority of this information must be encrypted.

Using the CodeIgniter framework and the CodeIgniter encryption class I can encode the information on the application side before storing it in the database. The CodeIgniter encryption class uses PHP's mcrypt function along with the AES_256 cipher.

The problem I have is that I need to allow the users of the application to search the information stored using a wildcard search, Possibly also via an API at a later date.

Any body come across a solution for a similar problem. I've read about the MySQL AES_ENCRYPT and AES_DECRYPT but they still require passing a key back and forth in plain text which I am reluctant to do.

I am currently at the conclusion that if I wish to continue on this route then a full table decryption is my only solution every time a search is made (obviously not good).

Member Avatar
11,316 posts since Jul 2006
Reputation Points: 1,420 [?]
Q&As Helped to Solve: 1,835 [?]
Skill Endorsements: 156 [?]

If your application/API runs on the same server as the database, passing the key plain text is not really an issue.

This article has been dead for over three months: Start a new discussion instead
Start New Discussion
Tags Related to this Article