Git Product home page Git Product logo

apsu's Introduction

APSU

Introduction

APSU is an unbalanced PSU protocol which is described in eprint.iacr.org/2022/653. The larger difference betweend the sizeof of two sets, the better our protocol performs.

How to build

Our APSU is amended form APSI, so you may use for reference the method of build APSI to compile APSU.

vcpkg

vcpkg can help you manange C and C++ libraries on Windows, Linux and MacOS. We recommend to build and install dependencies for APSU with vcpkg.
Some Dependencies which are needed by building APSU are as follows.

Dependency vcpkg name
Microsoft SEAL seal[no-throw-tran]
Microsoft Kuku kuku
Log4cplus log4cplus
cppzmq cppzmq (needed only for ZeroMQ networking support)
FlatBuffers flatbuffers
jsoncpp jsoncpp
TCLAP tclap (needed only for building CLI)
OpenSSL openssl

First follow this Quick Start on Unix, and then run:

./vcpkg install [package name]:x64-linux

To build your CMake project with dependency on APSU, follow this guide.

libOTe

libOTe is a fast and portable C++17 library for Oblivious Transfer extension (OTe). We can build it by following commands.

git clone --recursive https://github.com/osu-crypto/libOTe.git
cd libOTe
python build.py --setup --all --boost --relic
python build.py -DENABLE_SODIUM=OFF -DENABLE_MRR_TWIST=OFF -DENABLE_RELIC=ON --install=/your/path/libOTe

Notes

  1. LibOTE Releases 2.2.0 removed support of C++ 17, 14, so we recommand to use the old version, e.g. Releases 2.1.0 and earlier.
  2. libzmq has some conflict with libsodium. Please disable libsodium and replace it with librelic. You can refer README.md of libOTe for details.
  3. Default install folder of libOTe is thirdparty/. You can change this setting and pass the following arguments to CMake when configure: -DLIBOTE_PATH=/your/path/libOTe

Kunlun

Kunlun is an efficient and modular crypto library. We have embedded Kunlun into our code which is a head-only library, so you do not need to build or install Kunlun.

APSU

When you have all dependencies ready, you can build APSU by the following commands.

git clone https://github.com/real-world-cryprography/APSU.git
cd APSU
mkdir build
cd build
cmake .. -DLIBOTE_PATH=/your/path
cmake --build . 

Command-Line Interface (CLI)

Same as APSI, out APSU comes with example command-line programs implementing a sender and a receiver. In this section we describe how to run these programs.

Common Arguments

The following optional arguments are common both to the sender and the receiver applications.

Parameter Explanation
-t | --threads Number of threads to use
-f | --logFile Log file path
-s | --silent Do not write output to console
-l | --logLevel One of all, debug, info (default), warning, error, off

Sender

The following arguments specify the receiver's behavior.

Parameter Explanation
-q | --queryFile Path to a text file containing query data (one per line)
-a | --ipAddr IP address for a sender endpoint
--port TCP port to connect to (default is 1212)

Receiver

The following arguments specify the sender's behavior and determine the parameters for the protocol. In our CLI implementation the sender always chooses the parameters and the receiver obtains them through a parameter request. Note that in other applications the receiver may already know the parameters, and the parameter request may not be necessary.

Parameter
Explanation
-d | --dbFile Path to a CSV file describing the sender's dataset (an item-label pair on each row) or a file containing a serialized SenderDB; the CLI will first attempt to load the data as a serialized SenderDB, and – upon failure – will proceed to attempt to read it as a CSV file
-p | --paramsFile Path to a JSON file describing the parameters to be used by the sender
--port TCP port to bind to (default is 1212)

AutoTest

We have prapared an automated testing tool in the folder \tools. You could test whether APSU protocol works successlfully.

apsu's People

Contributors

lqvir avatar real-world-cryprography avatar

Stargazers

xiansongq avatar Weiran Liu avatar Liu Keyang avatar mincut03E5 avatar lx1234 avatar Eyal Kushnir avatar crypto-tobebetter avatar

Watchers

 avatar  avatar

Forkers

lqvir lky-stephen

apsu's Issues

Communication Between Different Hosts

Hi,

We failed to enable a communication between sender and receiver on different machines. It seems MS APSI does not support the related issue.

We have tried to specify the receiver machine's ip address in sender machine's sender.cpp file, with the following modified code:

int remote_query(const CLP &cmd)
{
    APSU_LOG_INFO(__FILE__ << __LINE__);
    auto SenderKKRTSocket = coproto::asioConnect("<host_R_ipAddr>:1212",false);
    APSU_LOG_INFO(__FILE__ << __LINE__);

where <host_R_ipAddr> is receiver machine's IP.

Then we rebuilded the project, started receiver machine listening at <host_R_ipAddr>:1212, and next started sender's query. Unfortunately, both machines stuck there and returned no communication information.

PS: we have successfully tested localhost case via two opening terminals with cli.

Insertion Failure in Cuckoo Table with Specific Dataset Sizes

Hi! I encountered an issue where the receiver side reported the failure indicated by a message about the inability to insert parameters into the cuckoo table.

Successful Test Cases:
(2^18, 2^10, 16M-1024.json)
(2^16, 2^10, 16M-1024.json)

Failing Test Case:
(2^16, 2^12, 16M-1024.json)
(2^18, 2^12, 16M-1024.json)
(2^16, 2^16, 16M-1024.json)
(2^18, 2^16, 16M-1024.json)
(2^20, 2^20, 16M-1024.json)

This issue arises consistently in different balanced/unbalanced dataset settings with the configuration 16M-1024.json.

As I did not find explicit illustration about tuning with JSON parameters, could you please provide more guidance on this matter?

Best wishes and happy new year!

Failed to create ReceiverDB when run auto-test.py Test1() function

Hi,

I have compiled the project successfully with all required dependencies. The compiler version is g++-10, with a python version 3.10.

Then I followed auto-test.py, and tried to set connections via the subprocesses. However, it reported an error "Segmentation fault (core dumped)" at sender process side, and an error "Failed to create ReceiverDB: Connection reset by peer; Failed to create ReceiverDB: terminating" at the receiver side.

This happened in both running the two cli in a single python script (i.e. run the file /tools/auto-test.py), and in two separate windows.

The detailed error logs are as follows, from a two-separate-running-window case:

root@cloud:/APSU/tools# APSU/build/bin/receiver_cli_ddh -d db.csv -t 4 -p /APSU/parameters/16M-1024.json --port 1212
INFO  09:34:41:756.955: /APSU/cli/receiver/receiver.cpp150
INFO  09:34:45:017.582: Setting thread count to 4
INFO  09:34:45:054.216: PSUParams have false-positive probability 2^(-53.2564) per receiver item
INFO  09:34:45:224.479: Start inserting 262144 items in ReceiverDB
INFO  09:34:45:283.485: Found 262144 new items to insert in ReceiverDB
INFO  09:34:45:356.402: /APSU/receiver/apsu/receiver_db.cpp158
INFO  09:34:45:356.541: /APSU/receiver/apsu/receiver_db.cpp187
ERROR 09:34:45:636.510: Failed to create ReceiverDB: Connection reset by peer
ERROR 09:34:45:668.893: Failed to create ReceiverDB: terminating

AND

ubuntu@cloud:/APSU/tools$ /APSU/build/bin/sender_cli_ddh -q query.csv -t 4 -p /APSU/parameters/16M-1024.json --port 1212
INFO  09:34:45:013.833: /APSU/cli/sender/sender.cpp126
INFO  09:34:45:017.649: /APSU/cli/sender/sender.cpp128
INFO  09:34:45:017.746: Connecting to tcp://localhost:1212
INFO  09:34:45:020.116: Successfully connected to tcp://localhost:1212
INFO  09:34:45:020.155: Sending parameter request
INFO  09:34:45:046.908: PSUParams have false-positive probability 2^(-53.2564) per receiver item
INFO  09:34:45:046.930: Received valid parameters
INFO  09:34:45:046.942: Setting thread count to 4
INFO  09:34:45:078.534: Sending APSU query
INFO  09:34:45:080.173: Creating encrypted query for 1024 items
INFO  09:34:45:080.570: /APSU/sender/apsu/utils.cpp17
Segmentation fault (core dumped).

PS: the issue happened when using the two same ports, or two different ports.

Do you have any suggestions for running a successful 2^10 vs. 2^18 -sized PSU case?

Looking forward to your reply : )

Permute + Share

您好,我只在代码中看到了OSN洗牌算法。我想知道20亚密中的那个洗牌算法是否没有在代码中实现。感谢您的帮助!

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.