Giter Club home page Giter Club logo

sealpir's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sealpir's Issues

Reuse Enc_Parameters and PIR_Parameters

How can we store and reuse Enc_Parameters and PIR_Parameters?
Because if we execute another time, the Enc_Parameters and PIR_Parameters will change. And we cannot decode previous replies anymore.

About Test

hello, I ran ctest . and got that:
image

I waited for a long time, but there was no change
pls help me, thank you!

Cannot Decrypt

I apologize for disturbing you again. I am doing some interesting things with your library, but I have encountered the following difficulties:

(1) Regarding the two encoding methods:
A: vector<uint64_t> message(N) --> plaintext = encoder.encode(message) --> ciphertext = encryptor.encrypt(plaintext);
B: plaintext(N, 0) --> plaintext[?] = ? --> ciphertext = encryptor.encrypt(plaintext);
What is the difference between these two methods? I previously observed that the multiplication of ciphertexts in method A essentially performs a vector dot product; whereas the latter seems to be the method used by SealPIR, which performs polynomial multiplication. I would really like to understand the fundamental differences between these two methods.

(2) Regarding method B, for some reason, as shown in the following code, it throws an Aborted error when it reaches decryption.
image
Any insights would be very helpful to me, thank you very much!

About the upper bound of `size_per_item`

Hello! :)
When size_per_item is set to 10241,it throws the below exception:
image
However, when size_per_item is set to 10240, it succeeds.
Except split the element into several chunks to create multiple databases of chunk-size,
how to increase the upper bound of size_per_item?
Thanks for your time in advance!

undeclared identifier logtp

pir_server.cpp # 124

change elements_per_ptxt(logtp, N, ele_size) to elements_per_ptxt(logt, N, ele_size)

Answer process

First of all, I only read the papers.
For simplicity, we set d to 1. For n entries (Entry_i, 0<=i<n-1), after executing expand, n ciphertexts are produced, one of which is Enc(1) and the rest is Enc(0). My question is: how is Entry_i encoded into plaintext?
Suppose Entry_i = {10,10,... , 10,... }
Enc(1) = Enc({1,0,0,0,0,...})
Enc(1) * Entry_i = {10,0,0,0,... }
That doesn't seem to get the full value of Entry_i, right?

How does SealPIR support Keyword PIR?

I found that many libraries that depend on SEAL PIR support Keyword PIR. However, when I read the paper "PIR with compressed queries and amortized query processing", I only found index PIR mentioned.

image

However, the paper also states that SEAL PIR can support the keyword model. This is achieved by encoding the keywords as bit vectors and representing them as polynomials. The client then encrypts these polynomials and sends them to the server, which evaluates them using homomorphic operations. This allows the server to retrieve the matching documents without learning the keywords.

I wanna which paper or any other research papers that specifically focus on implementing keyword PIR using SEAL PIR, where could I found it

fatal error: 'seal/seal.h' file not found

I have installed SEAL 3.2.0 on macOS Catalina version 10.15.7 and it works fine (Unit tests passed and examples works).

Having issues running SealPIR.

devharsh@Devharshs-MBP SealPIR-master % sudo LDFLAGS="-L/usr/local/lib/" CFLAGS="-I/usr/local/include/" make
[ 16%] Building CXX object CMakeFiles/sealpir.dir/pir.cpp.o
In file included from /Users/devharsh/Downloads/SealPIR-master/pir.cpp:1:
/Users/devharsh/Downloads/SealPIR-master/pir.hpp:3:10: fatal error: 'seal/seal.h' file not found
#include "seal/seal.h"
^~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/sealpir.dir/pir.cpp.o] Error 1
make[1]: *** [CMakeFiles/sealpir.dir/all] Error 2
make: *** [all] Error 2

What is CIPHER_SIZE?

In the file main.cpp there is this comment:

    //To marshall query to send over the network, you can use serialize/deserialize:
    //std::string query_ser = serialize_query(query);
    //PirQuery query2 = deserialize_query(d, 1, query_ser, CIPHER_SIZE);

What is CIPHER_SIZE? The number of coefficients of a ciphertext? The number of bytes? Could you please define it? A macro or function would be fine.

Also, what is the meaning of the 1? A little documentation would be helpful.

N=1024 or N=2048

Is there any theoretical reason that N=1024, 2048 can not be used for this protocol? Or is it just a technical limitation in SEAL? If the limitation is theoretical, can you point me to any papers which discuss this limitation?

Thanks.

A question of the test program main

Hello! I test the program in abeams/sealPIR:master. When I set the polynomial modulu N to 2048, the error is
terminate called after throwing an instance of 'std::logic_error
what(): keyswitching is not supported by the context

According to the notes, I tried to set the modulus switching chain
enc_params.set_coeff_modulus(CoeffModulus::Create(N, {27,27}));
The error is:
Client: 1/ 2-th decryption layer started.
Client: done.

Client: 2/ 2-th decryption layer started.
terminate called after throwing an instance of 'std::invalid_argument'
what(): encrypted is not valid for encryption parameters
Aborted

What should I do when I set N to 2048?

Could not find a configuration file

$ cmake . -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++
CMake Error at src/CMakeLists.txt:1 (find_package):
Could not find a configuration file for package "SEAL" that is compatible
with requested version "4.0".

The following configuration files were considered but not accepted:

/usr/local/lib/cmake/SEAL/SEALConfig.cmake, version: 3.2.0

-- Configuring incomplete, errors occurred!
See also "/home/sberenji/SealPIR/CMakeFiles/CMakeOutput.log".

SealPIR does not currently handle d>2

The current implementation does not work correctly when the database is represented a d-dimensional hyperrectangle when d is larger than 2. This is a known issue and we are currently working on it.

Does sealpir support multi-core computing?

I found the following information in your paper “We run the PIR servers on H16 instances (16-core 3.6 GHz Intel Xeon E5-2667 and 112 GB RAM), and clients on F16s instances (16-core, 2.4 GHz Intel Xeon E5-2673 and 32 GB RAM), all running Ubuntu 16.04.”. It seems that sealpir support multi-core parallel computing. But when I run main.cpp, I only use one cpu core.

A question about plaintext encoding.

Hi! According to the paper, the client encodes his desired query i into a monomial as follows :
image
image
But I can't find in which part of this code the encoding process is implemented.
Looking forward to a reply. Thanks.

Hypercube expansion

It is unclear to me how the hypercube expansion works exactly. For example, with

uint64_t number_of_items = 1 << 16; 
uint64_t size_per_item = 12*4096/8; // in bytes
uint32_t N = 4096;

// Recommended values: (logt, d) = (12, 2) or (8, 1). 
uint32_t logt = 12; 
uint32_t d = 2;

The loop to expand the query into a hypercube in the generate_reply function:

  for (uint32_t i = 0; i < nvec.size(); i++) {
     vector<Ciphertext> expanded_query; 

    
        auto time_server_s = high_resolution_clock::now();
        uint64_t n_i = nvec[i];

        for (uint32_t j = 0; j < query[i].size(); j++){
            uint64_t total = N;  

            if (j == query[i].size() - 1){ 
                total = n_i % N;  
            }

            vector<Ciphertext> expanded_query_part = expand_query(query[i][j], total, client_id);
            expanded_query.insert( expanded_query.end(),
                                   std::make_move_iterator(expanded_query_part.begin()), 
                                   std::make_move_iterator(expanded_query_part.end()));
            expanded_query_part.clear(); 
        }

This loop produces 256 polynomials with 256 non-zero cipherthext coefficients each; granted all but one encrypt the plain text value of 0. The loop that does the Homomorphic selection is the following:

 for (uint64_t k = 0; k < product; k++) {

            evaluator_->multiply_plain(expanded_query[0], (*cur)[k], intermediateCtxts[k]);
            for (uint64_t j = 1; j < n_i; j++) {
                evaluator_->multiply_plain(expanded_query[j], (*cur)[k + j * product], temp);
                evaluator_->add_inplace(intermediateCtxts[k], temp); // Adds to first component.
            }
        }

Here is my confusion: it is my understanding that each coefficient of every polynomial should, by themselves, be multiplied by the (k+j * product)-th element of the database, and then accumulated using addition into a single value. This is not what happens, instead all 256 polynomials get multiplied 256 times each, where polynomial k multiplies with entry 256*n+k for all n up to 0< n < 256. How is this selecting one entry in the database? Where each entry takes up the entire ciphertext space for one polynomial with 4096 coefficients and 12-bits available in each one(total of 6144 bytes).

Also, on the second round of the loop, since "nvec.size = 2" we have n_i = 256 but product = 10? I do not understand this at all. Any comments on the matter would be greatly appreciated.

SEAL 3.5.8 and expanded query invalid encryption parameters on decryption

I am trying to make the the expanded_query() function work with SEAL 3.5.8 and I am having a hard time. The generate_query function is fine, but when I try the expand query I get my vector of ciphertexts, and when I try to decrypt any one of them to verify the expansion was done correctly I get:

terminate called after throwing an instance of 'std::invalid_argument'
  what():  encrypted is not valid for encryption parameters
Aborted (core dumped)

Should I not be able to decrypt all the ciphertexts returned by expanded_query? I was looking at the multiply_power_of_X and wonder if that internal manipulation of data to do the multiply is compatible with SEAL 3.5.8. Any suggestions to fix this would be greatly appreciated.

Expand Alogrithm in paper

I am confused about the pseudocode described in the paper. Take the Figure 3 and Figure 4.
(1) query = Enc(x^2);
(2) First Outer loop: C0=Enc(x^2), C1=Enc(x^1), C0'=C0+sub(C0,5), C1'=C1+sub(C1,5);
In this step, sub(C1, 5) = Enc(x^5) mod x^4+1 = Enc(-x^1), so C1= Enc(0);
But, sub(C0, 5) = Enc(x^10) mod x^4+1, I do not know if my solution is right, but x^10 = x^4+1 * (x^6-x^2) + x^2, so sub(C0,5) = Enc(x^2) ? If it is true, C0' = Enc(2x^2), why the result in Figure 4 is [0,2,0,0], i.e., Enc(2x^1)?

I would appreciate it if you could point out my mistake.

SEAL 2.3.1

Hi,

SEAL repo does not provide the version of 2.3.1 available.

About ctest

After cmake .,i encounter the below error when ctest .
image
Thanks for your time in advance! :)

PBC

Where is PBC used

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.