Git Product home page Git Product logo

onion-pir-clone's Introduction

OnionPIR: Response-Efficient Single-Server Private Information Retrieval

This repository contains code for OnionPIR: Response Efficient Single-Server PIR

Note that OnionPIR protocol can be implemented using different parameters selection. In paper we disccussed one such selection that showed best results but we can optimize OninPIR design by picking different parameters. Check branch small-onionpir for one extra example.

Dependencies

OnionPIR scheme utilizes recent advances in somewhat homomorphic encryption (SHE) and carefully composes two lattice-based SHE schemes and homomorphic operations to control the noise growth and response size. OnionPIR achieves a response overhead of just 4.2x over the insecure baseline.

Compilation

  1. First download Microsoft Seal version 3.5.1. This will be cloned in SEAL directory.
// Bounds for bit-length of all coefficient moduli
//#define SEAL_MOD_BIT_COUNT_MAX 61
#define SEAL_MOD_BIT_COUNT_MAX 62
#define SEAL_MOD_BIT_COUNT_MIN 2

// Bit-length of internally used coefficient moduli, e.g., auxiliary base in BFV
//#define SEAL_INTERNAL_MOD_BIT_COUNT 61
#define SEAL_INTERNAL_MOD_BIT_COUNT 62

// Bounds for bit-length of user-defined coefficient moduli
//#define SEAL_USER_MOD_BIT_COUNT_MAX 60
#define SEAL_USER_MOD_BIT_COUNT_MAX 62
#define SEAL_USER_MOD_BIT_COUNT_MIN 2
//    // Check if the parameters are secure according to HomomorphicEncryption.org security standard
//  if (context_data.total_coeff_modulus_bit_count_ > CoeffModulus::MaxBitCount(poly_modulus_degree, sec_level_))
//    {
//       // Not secure according to HomomorphicEncryption.org security standard
//       context_data.qualifiers_.sec_level = sec_level_type::none;
//       if (sec_level_ != sec_level_type::none)
//         {
//             // Parameters are not valid
//              context_data.qualifiers_.parameter_error = error_type::invalid_parameters_insecure;
//              return context_data;
//          }
//    }
//auto baseconv_primes = get_primes(coeff_count_, SEAL_USER_MOD_BIT_COUNT_MAX + 1, base_Bsk_m_tilde_size);
auto baseconv_primes = get_primes(coeff_count_, SEAL_USER_MOD_BIT_COUNT_MAX , base_Bsk_m_tilde_size);

These changes are needed because there is incompatibility between SEAL and NFLlib

  1. Now build and install SEAL library by using following commands:
cmake . -DCMAKE_BUILD_TYPE=Release -DSEAL_USE_MSGSL=OFF -DSEAL_USE_ZLIB=OFF
make
sudo make install
  1. And then install NFLlib
  2. Make sure these libraries are properly installed in /usr/local/lib and /usr/local/include
  3. Now clone Onion-PIR in seprate folder.
  4. Then build the library using following commands:
cmake . -DCMAKE_BUILD_TYPE=Release -DNTT_AVX2=ON -DSEAL_USE_ZLIB=OFF -DSEAL_USE_MSGSL=OFF
make
  1. Then just run ./onionpir. This file is your build file that should be in the same folder where you run above commands.

PIR Library

  • This implementation sets q\approx 2^{124}, n=4096, t\approx 2^{60}, where q= coefficient mod, n= polynomial degree, t= plaintext mod. These parameters allow expansion factor of 4.2 only.

  • There are a Server and Client classes with their dedicated operations.

  • Server.set_database: Initialize the database.

  • Server.preprocess_database: Performs decomposition and NTT on the database and store database in NTTes form.

  • Client.generate_query_combined: Generates query for client index.

  • Server.generate_reply_combined: Evaluates PIR query over database using client's encrypted query.

onion-pir-clone's People

Contributors

mhmughees avatar rasoulam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.