# Searchable Encryption with Substring Search

I want to search substrings in encrypted string. To do that I have read “Implement Rabin-Karp Algorithm” and “Substring-Searchable Symmetric Encryption”. After that, I completed the Rabin-Karp implementation. But, those does not answer for my problem. Rabin-Karp requires both main string for searching substrings and substring to be searched. What I want to do is finding patterns in encrypted strings without decrypt it?

• Let me make sure I understand, you want to be able to encrypt a string, send it to some untrusted 3rd party. That 3rd party should be able to find patterns in the encrypted strings without the decryption key? Are these patterns supplied by the user? Commented Apr 25, 2016 at 11:39
• I don't understand what exactly you want. The second paper you linked by Chase and Shen is pretty much the state of the art in this area, so you might want to just do that. Commented Apr 25, 2016 at 22:17
• mikeazo, you understand my problem exactly. Commented Apr 26, 2016 at 10:50
• pg1989, This paper was very helpful. But, it is not easy to implement algorithm starting from it. Commented Apr 26, 2016 at 10:57
• My layman's question: Could your goal be exactly realizable at all for materials that are encrypted by sufficiently strong algorithms? (Do I understand correctly that you want to have a way to check whether a possible string guessed from context, say "Execute Plan B!", is in the plaintext corresponding to a given ciphertext?) Commented Apr 27, 2016 at 13:55

There are some works both theoretical and practical that they do solve your problem efficiently and in a secure way. By efficiently i mean the search efficiency is linear on the size of the searched substring. This is achieved by using auxiliary data structures known as suffix tree. Chase and Shen follow this approach, by encrypting the suffix tree with symmetric primitives.

This work does not use any auxiliary data structure for efficiency. It encrypts consecutive n-grams and their positions.

A theoretical work follows another technique. By altering the subset sum problem to be easily solvable they issue subset sum instances to the cloud, and the cloud solves them polynomially and the solutions are the positions in the original string of the substring.

Stronger security guarantees with oblivious ram are presented here

• I am looking for practical solutions for this job. But, I have not come across any of them yet. This article and work does not include what i seek. Commented Apr 26, 2016 at 11:00
• what is practical for you? Why Chase and Shen is not practical? Commented May 4, 2016 at 5:49

I am afraid you are a little early: searchable encryption is quite a new field in cryptography, and I am not sure there exists any good implementation yet. However, answers to this question suggest cryptdb.

Also, I do not think the Rabin-Karp Algorithm is easily transposable to searchable encryption. I believe it has many optimisations, which could conflict with the internal workings of the encryption schemes. I'm not saying it is impossible, though.

• CryptDB doesn't do this, and its security is not well-understood. CryptDB is not the right tool for this problem. Commented Apr 25, 2016 at 22:16
• I have read many articles about CryptDB. It does not support substring operations as mentioned here. CryptDB does not support queries on certain sensitive fields that perform string manipulation (e.g., substring and lowercase conversions) or date manipulation (e.g., obtaining the day, month, or year of an encrypted date). However, if these functions were precomputed with the result added as standalone columns (e.g., each of the three parts of a date were encrypted separately), CryptDB would support these queries. Commented Apr 26, 2016 at 11:06