Is there any library/tool available which can allow me to search over encrypted data? I would like to encrypt data on client side, send it to cloud and perform search in cloud.

I've been reading about homomorphic encryption and though there is CryptDb available which makes it possible to run encrypted DB in cloud, but my use case is slightly different- in my case I want to let users send me encrypted data and I want to be able to do a keyword search (as opposed to user performing search).

  • 3
    $\begingroup$ Can you be more specific with your requirement ? If users send the encrypted data to you , are you some kind of proxy ? will you know the search terms in plain text ? $\endgroup$ – sashank Dec 31 '12 at 12:16
  • 1
    $\begingroup$ See a related question: crypto.stackexchange.com/questions/3446/… $\endgroup$ – mikeazo Dec 31 '12 at 13:02
  • $\begingroup$ @sashank I may or may not know search terms. Ideally not, but I am okay with a design if I will be required to receive keywords in plaintext $\endgroup$ – user375868 Jan 1 '13 at 1:03
  • $\begingroup$ This is a duplicate of Is it possible to match encrypted documents using user-defined search terms?. There are rich variety of techniques for solving this problem. See my answer there for an entry-point into the literature. $\endgroup$ – D.W. Jan 1 '13 at 21:16

I don't think there is an existing library that can satisfy your needs.

Homomorphic encryption is powerful and requires lots of computations. However, in your case which allows user-defined keywords, I suggest you to take a look at Searchable Encryption.

Searchable Encryption is the algorithm that should be of interest. It allows cloud server to search 'blindly' on client's encrypted data, based on a 'trapdoor' - a token that contains keywords to be searched for - sent by the client. Of course, client must also encrypt the keywords along the encrypted data before uploading them, which will surely increase the overhead. For 'blindly' it means the cloud server doesn't acquire any unnecessary knowledge about the searched keywords and the encrypted data, during the entire query process.

Some of the searchable encryption algorithms are based on pairing-based cryptography. In that case, you can build your application based on PBC library.


Take a look at the SSARES system. According to the abstract,

Our solution encrypts email (the headers, body, and attachments) as it arrives on the server using public–key encryption. SSARES uses a combination of Identity Based Encryption and Bloom Filters to create a searchable index.

This index reveals little information about search keywords and queries, even against adversaries that compromise the server. SSARES remains largely transpar- ent to both the sender and recipient.

  • $\begingroup$ Hello insane and welcome to Crypto.SE. I've edited your answer because the previous link didn't lead to the PDF directly. I've also quoted a few paragraphs from the abstract. This IMO makes for some better content overall. If you feel I've overstepped, you can always roll back to the original, but please quote me in a comment so I know what could have been done better. Cheers $\endgroup$ – rath Feb 26 '14 at 16:11
  • $\begingroup$ Your edit is "fine". The thing is, that I already used the implementation and would actually recommend to ask the author for the code. That got lost. $\endgroup$ – user2504380 Sep 22 '14 at 14:27

In your requirement ,

  • if the users trust you , they may share their key's as well with you to perform search operations on their behalf and you act as proxy to send the queries and receive results
  • If the users don't trust you, then you would just be a relay agent for the cloud , instead users can search directly over the cloud to reduce the latency.

Apart from the search over encryption links suggested above in the comments, you may want to look at CP-ABE schemes as well , Cipher Text Policy Attribute Based Encryption library.


Not the answer you're looking for? Browse other questions tagged or ask your own question.