Encrypted Keyword Searches with Crypto Pairing and MIRACL
We give away too much information. Let’s say I have to search to see if a given post code is on a database, but I want to keep the search and search term secret. In this case we will implement the following [paper]:
First we have two curves (G1 and G2) and initially we define a large prime number (q). First a trust server selects a point on the G2 curve (P), and generates a using a random number (s):
sk=s
Alice creates a public key with:
Apub=sP
Next Trent creates a random value (r) and creates:
Pr=rP
Trent hashes the word to search (M) to the G2 curve:
QW=H1(M)
And creates the pairing of:
(U,V)=(Pr,e (QW,Apub)^r
If Bob wants to search for W2, he matches to:
e (Tw,Pr)
and where Tw=sH1(W2)).
Coding
The outline coding using the library from the MIRACL library [here] is
package main