scalable-rbe 0.1.1

A prototype of a scalable Registration-Based Encryption scheme based on standard lattice assumptions
Documentation

Prototype of 'Scalable Registration-Based Encryption from Lattices'

Dependencies

  • Rust version >= 1.86.0 (optional: nightly toolchain to enable AVX-512 hardware acceleration if available by passing --features=nightly to cargo bench)
  • Installation of several standard libraries such as cc, which come out-of-the-box with several Linux distributions but can be installed using sudo apt install build-essential

To check the version and toolchain, use rustc --version. To update rustup update. To install the nightly toolchain, rustup toolchain install nightly.

Building on this project

To integrate this library in your project, you can create a dependency via crates.io the command

cargo add scalable-rbe

Then, you can use the exposed API RBE::init(false), rbe.setup(), rbe.keygen(&pp), etc. to utilise Registration-Based Encryption in your protocol.

WARNING: This is a prototype and should not be used in a production envirnoment. This implementation does not provide any side-channel security.

If you need to use different parameters, please clone/fork this project and create a dependency based on your GitHub repository or local directory. Please ensure that any diverging set of parameters meets the correctness and security requirements specified in our paper. You can use our parameter selection script to find valid sets of parameters.

Executing Tests and Benchmarks

If you want to verify the results of this project, i.e. build the project, run its unit tests, build its documentation, or run the benchmarks, there are three options.

  1. Local installation of dependencies to enable the local execution of all relevant commands.
  2. If you are using a Debian-based operating system, you may utilise make to install all dependencies and run all commands automatically.
  3. Follow the instructions to setup a docker container and execute all commands in the container.

Makefile

If you are running a Debian-based operating system, you may use make all to ensure all dependencies are properly installed. Otherwise, you can still use make verify to build, test, and run benchmarks for this project and we refer to the Docker image as an alternative to create a container with preinstalled dependencies.

Docker

We assume that Docker Desktop is setup on your machine. Then, you can build the appropriate docker image by executing

docker build -t rbe-env .

Once the build is finished, your docker image is saved as rbe-env and we can enter the image by running the following command.

docker run -it rbe-env

Now, you can run make verify to build, test, and run benchmarks for this project.

Alternatively, you can interactively run any cargo commands inside your Docker container. Use exit to leave the container.

Relevant Commands

Ensure that all dependencies are setup as required. Then, the following yields a list of valid commands to build, test, and benchmark this project.

To build the library, run

cargo build --release

The documentation is available at docs.rs or you can generate it yourself by executing

cargo doc --open

If you're using WSL and your browser does not open, retry after installing wslu.

To run all unit-tests, which also ensure correctness of the parameters and construction, execute the following line.

cargo test --release -- --test-threads=1 # single threaded to prevent simoultaneous writes to the database from different tests

To benchmark all RBE algorithms, you can use

cargo bench RBE

If you have criterion installed, you can also execute

cargo criterion RBE

To benchmark just a single algorithm, we refer to ./benches/rbe.rs.

Note on Benchmarks

The benchmarks in the paper were conducted on an Intel Core Ultra 7 165U 4.9 GHz CPU with 32 GB of RAM using AVX2 / SIMD acceleration and 14 threads. The number of threads impacts the execution time of encryption Enc significantly (as it is the only multi-threaded algorithm). Our experimental results show that disabling AVX2 instructions may slow down the execution time of some algorithms up to a factor of 2. We did not conduct any experiments with AVX-512 acceleration.

Troubleshooting

If a test or benchmark fails, please reset the registry by deleting the registry_db directory (if it exists and you are not running any tests or benchmarks). This directory holds the current state of the RBE's registry and is centralised across all executions. Some tests and benchmarks expect it to be empty upon start. Each test and benchmark wipes it after execution. Thus, problems mainly arise through manual interceptions or parallel execution.


Parameter Generation

The script for parameter generation can be found in the directory params. Please follow the instructions in the README to execute the script.

License

This library is distributed under the Mozilla Public License Version 2.0. Permissions of this weak copyleft license are conditioned on making the source code of licensed files and modifications of those files available under the same license (or in certain cases, under one of the GNU licenses). Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. However, a larger work using the licensed work may be distributed under different terms and without source code for files added to the larger work.