Eric Swenson, Evgeny Chistyakov
- Install requred packages:
sudo apt-get install mysql-server
(MySQL server)sudo apt-get install libmysqlclient-dev
(MySQL header files)sudo apt-get install m4
(gmp library dependens on it)sudo apt-get install make
(needed for compilation)sudo apt-get install gcc
(needed for compilation)
- Download/clone this repo
- Extract the libraries (paillier/libs)
tar xvfz libpaillier-0.8.tar.gz
tar xvfj gmp-6.1.0.tar.bz2
- Install the gmp library (depends on m4)
- Navigate to extracted library folder
./configure
make
sudo make install
- Install the paillier library (depends on gmp)
- Navigate to extracted library folder
./configure
make
- Open generated Makefile in text editor and add
-fPIC
flag to the list of CFLAGS sudo make install
- Compile the C code
- Navigate to paillier/src
make
- Output binaries are: encrypt, decrypt, key_factory, sum_he.so
- Copy sum_he.so to MySQL plugins folder:
sudo cp sum_he.so /usr/lib/mysql/plugin
- Register SUM_HE with MySQL:
CREATE AGGREGATE FUNCTION sum_he RETURNS STRING SONAME 'sum_he.so';
- To deregister:
DROP FUNCTION sum_he;
- Install required packages:
sudo apt-get install python-pip
sudo apt-get install python-dev
sudo pip install mysql-connector-python --allow-external mysql-connector-python
sudo pip install tabulate
- Copy encrypt and decrypt binaries into the /client folder:
cp encrypt ../../client
cp decrypt ../../client
- Update the config dictionary in client.py (user, password, host, etc.)
- Launch the client:
python client.py cc0b753172e2f753226965e9bb85d4f3 6605ba98b9717ba8ac482a7be12840a8
(public key is hardcoded into sum_he.so)