This repository contains Python implementations of Libertas [1] and Z&N [2].
Libertas is a novel construction for creating dynamic symmetric searchable encryption schemes in the single-user environment that are backward-private and allow for wildcard queries.
pip install -r Libertas/requirements.txt
The code comes with a command line interface where users can run the implemented schemes locally, showcasing the add, delete and search functionalities.
python3 Libertas
To run Libertas with a different wildcard supporting scheme, implement SigmaClient
and SigmaServer
(see ZNClient
and ZNServer
for an example). An example for Libertas is provided below.
from src.libertas.libertas_client import LibertasClient
from src.libertas.libertas_server import LibertasServer
from src.sigma_interface.sigma_client import SigmaClient
from src.sigma_interface.sigma_server import SigmaServer
# Initialize Libertas client
wildcard_client = SigmaClient()
client = LibertasClient(wildcard_client)
security_parameter = (256, 2048)
client.setup(security_parameter)
# Initialize Libertas server
wildcard_server = SigmaServer()
server = LibertasServer(wildcard_server)
server.build_index()
# Add document-keyword pair
(ind, w) = (1, 'keyword')
add_token = client.add_token(ind, w)
server.add(add_token)
# Search keyword
w = 'keyword'
search_token = client.srch_token(w)
documents = server.search(search_token)
# Search wildcard query
q = 'k_y*'
srch_token = client.srch_token(q)
documents = server.search(srch_token)
# Delete document-keyword pair
(ind, w) = (1, 'keyword')
del_token = client.del_token(ind, w)
server.delete(del_token)
Several tests are provided. These are run automatically by GitHub Actions. To run them locally, run:
pytest Libertas
Pull requests containing documented and tested code are welcome. Feel free to submit improvements, implementations of other wildcard schemes or otherwise relevant extensions to the code. For major changes, please open an issue first to discuss what you would like to change.
The code is available under the MIT license.