BUET-UG-Thesis-Jan22-Blockchain-ASMLH / Searchable-Symmetric-Encryption

Searchable Symmetric Encryption

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Searchable Symmetric Encryption with order preservation

N.B.

  • pip install -r requirements.txt
  • DemoCodes/FreshCopy has been created by following the steps already.
  • main00, main01, ... etc has been created by following the codes given in the steps.
  • DemoCodes/ExampleTestSSE is an example of simulation

About

Searchable Symmetric Encryption enables search over encrypted data.
Order preservation gives us possibility to search over encrypted data not only by exact match but also with operators like < and >.

Solution

Solution of the problem is based on this article.

Search steps over encrypted data:

  1. Create three example json data files. You can create examples if you execute python file create_patient_json.py. One of examples is shown in the picture.
    alt json_file

  2. Create 32B index and document key and save them: SSE class method generate_and_save_keys.

  3. Generate 16B IVs and update document index - SSE class method update_IVs_and_doc_index.

  4. Create switched document index for server - SSE class method create_switched_document_index.

  5. Create inverted document index - OPE class method create_inverted_keyword_index.

  6. Create index for all distinct values for every field - OPE class method create_index_of_values.

  7. Encrypt inverted document index with index key and save it on server - OPE class method encrypt_index.

  8. Encrypt all example documents with document key and save it on server - OPE class method encrypt_documents.

  9. Search over encrypted data - OPE class methods generate_search_token and search.

  10. Copy encrypted files that fit the query to user - OPE class method copy_encrypted_files_to_user.

  11. Decrypt files at user with document key - OPE class method decrypt_documents.

Instructions for establishing working directory

  1. Create empty folder and name it for example TestSSE.

  2. Inside this directory create five more folders and name them Data, Private, Server, SSE, User.

  3. Inside Private directory create empty folders named keys and IVs.

  4. Inside Private directory create json file document_index.json with empty brackets {}.

  5. Inside Private/IVs directory create json file ivs.json with empty brackets {}.

  6. Inside SSE directory copy all files downloaded from github link https://github.com/markozeman/SSE.git.

Your directory structure should look something like this:
alt folder_structure

  1. Inside SSE/src directory execute create_patient_json.py file.

  2. In terminal move to SSE/src directory, start ipython and execute this commands:

from SSE import SSE
sse = SSE()

sse.generate_and_save_keys()
sse.update_IVs_and_doc_index()

After that your directory structure should look something like this:
alt folder_structure_2

  1. In terminal move to SSE/src directory, start ipython and execute this commands:
from SSE import SSE
from OPE import OPE
sse = SSE()
ope = OPE()

sse.create_switched_document_index()
ope.create_inverted_keyword_index()

After that your directory structure should look something like this:
alt folder_structure_3

Inverted index should look like this:
alt inverted_index

  1. In terminal move to SSE/src directory, start ipython and execute this commands:
from OPE import OPE
ope = OPE()

ope.create_index_of_values()
ope.encrypt_index()
ope.encrypt_documents()
  1. Inside User directory make two empty directories named encrypted and decrypted.

After that your directory structure should look something like this:
alt folder_structure_4

Encrypted file of Janez Novak should look like this:
alt encrypted_file

  1. Now we have everything prepared to use graphical interface to search over data.

GUI usage example

GUI - razloži, kako se zažene in uporablja.

Graphical interface gives you opportunity to search over encrypted data with simple clicking. After you click Search! button, query is parsed and execute search over encrypted data. Files that match query are copied to User/encrypted folder and then decrypted to User/decrypted folder.

We start GUI by executing GUI.py file in SSE/src directory.
alt gui


In our solution we used Python 3.5.2 and Anaconda 3.

About

Searchable Symmetric Encryption


Languages

Language:Python 100.0%