Skip to content

An Implementation of the Fully Homomorphic Smart-Vercauteren Cryptosystem

License

Notifications You must be signed in to change notification settings

blindstore/libScarab

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This is an implementation of a fully homomorphic encryption scheme using large integers. The mathematical foundation is based on work by C. Gentry [1] for the initial concept as well as N. Smart and F. Vercauteren [2] for the integer-based approach used in this implementation.

The library presented here is beta software and should not be used for any mission critical applications. No warranty expressed or implied is given.

Installation and usage

First, clone this repository on your machine: git clone https://github.com/blindstore/libScarab.git.

Prerequisites

The library depends on the following libraries:

For Debian-based systems

  • sudo apt-get install build-essential m4 lzip unzip
  • Use ./scripts/install-dependencies.sh from this repository to install the dependencies.

For Arch Linux

  • Install base-devel m4 unzip gmp mpfr from official repositories.
  • Install mpir from AUR. Install version 2.6.0 and pay attention to the comment made by Fincer on 2014-06-20 18:32.
  • Install Flint manually: Execute the according part at the bottom of ./scripts/install-dependencies.sh, but before create /etc/ld.so.conf.d/locallib.conf with just one line of content: /usr/local/lib.

For Mac OS

  • You can install lzip gmp with brew
  • Install the other dependencies using ./scripts/install-dependencies.sh

Build

The compilation is done using make.

$ make

This builds an executable bin/integer-fhe that runs a test of the library and a shared library file in build/libscarab.so.

Install

$ sudo make install

will place ./build/libscarab.so in /usr/local/lib and run ldconfig.

Usage

You can use the library as demonstrated in test.c. The following methods are exposed:

fhe_keygen(fhe_pk_t pk, fhe_sk_t sk);                    // Generate a keypair
fhe_encrypt(mpz_t c, fhe_pk_t pk, int m);                // Encrypt a message (0 or 1)
fhe_decrypt(mpz_t c, fhe_sk_t sk);                       // Decrypt a cyphertext
fhe_recrypt(mpz_t c, fhe_pk_t pk, fhe_sk_t sk); 	 // Recrypt a cyphertext (“refreshing” it)
fhe_add(mpz_t res, mpz_t a, mpz_t b, fhe_pk_t pk);       // Add cyphertexts (= XOR)
fhe_mul(mpz_t res, mpz_t a, mpz_t b, fhe_pk_t pk);       // Multiply cyphertexts (= AND)
fhe_fulladd(mpz_t sum, mpz_t c_out, mpz_t a, mpz_t b, mpz_t c_in, fhe_pk_t pk);  // Add with carry in and carry out
fhe_halfadd(mpz_t sum, mpz_t c_out, mpz_t a, mpz_t b, fhe_pk_t pk);  // Add with carry out

Uninstall

$ sudo make uninstall

will remove the library from /usr/local/lib.

Uninstall dependencies

If you used ./scripts/install-dependencies, you can uninstall them using

$ ./scripts/uninstall-dependencies

This will basically call sudo make uninstall for each of GMP, MPFR and MPIR and undo the commands executed for the installation of Flint.

References

[1] C. Gentry, A fully homomorphic encryption scheme

[2] N. Smart and F. Vercauteren, Fully Homomorphic Encryption with Relatively Small Key and Ciphertext Sizes

[3] H. Perl, M. Brenner and M. Smith, POSTER: An Implementation of the Fully Homomorphic Smart-Vercauteren Crypto-System

License

The source code is published under a MIT license:

Copyright © 2011, 2014

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

An Implementation of the Fully Homomorphic Smart-Vercauteren Cryptosystem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Mathematica 85.2%
  • C 12.8%
  • Shell 1.3%
  • C++ 0.7%