1

I want to encrypt my data before save them in my database.

One of my fields is a numeric value and I want to search in the table items upper or lower than a specified item. For example I save my data 3287 encoded, and I want to find which items has value upper than 500.

In the case of huge rows (For example 100,000,000 rows) it is too inefficient to decrypt each element and check the value.

Is there any better solution for my problem?

Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
Mohammad
  • 31
  • 3
  • 10
  • This is a very challenging problem for which you aren't likely to find excellent solutions readily available. – President James K. Polk Jul 12 '14 at 15:16
  • 2
    Try to research in the [homomorphic encryption](http://en.wikipedia.org/wiki/Homomorphic_encryption) direction. There is not lot, if any at all, of ready to use things in that field yet. Also check [this](http://stackoverflow.com/questions/1023981/practical-applications-of-homomorphic-encryption-algorithms), [this](http://stackoverflow.com/questions/2576145/calculate-the-average-of-three-encrypted-numbers) and [this](http://stackoverflow.com/questions/15109530/encryption-that-allows-performing-mathematical-operations-on-encrypted-numbers) questions. – Oleg Estekhin Jul 12 '14 at 18:05
  • @owlstead Sorry, but I didn't understand your comment. – Mohammad Jul 13 '14 at 13:07
  • @Mohammad Ah, yes, I was responding to Oleg's comment as homomorphic encryption is possibly the answer (or at least the problem) you are looking for. As a workaround, you may add an attribute to each encrypted value to show in which range it resides. This is much easier to accomplish, but you leak the range information. – Maarten Bodewes Jul 13 '14 at 13:13

1 Answers1

1

Old Q but maybe you wanted an encrypted database index. For something FOSS that front-ends MySQL and Postgres, check out CryptDB. Supports some homomorphic encryption and much more. Paper Another paper MSFT arguable crack

For encrypted full-text search Hitachi Credeon is built on Solr. It uses homomorphic encryption IIRC.

There's also the NSA's project on Apache which is likely deployed on a massive scale to search everyone's underwear drawer and pr0n collection... it's basically CouchBase meets Solr.