yuchen1024 / Twisted_ElGamal_PKE

This project implements twisted ElGamal PKE, which is additively homomorphic and zero-knowledge proof friendly.
6 stars 1 forks source link

Twisted ElGamal: ZKP-friendly Homomorphic PKE

Overview

This is an implementation of twisted ElGamal. Twisted ElGamal PKE resembles standard exponent-version ElGamal PKE (also known as lifted ElGamal), but with a simple twist, i.e., switching the roles between key encapsulation and DEM key. The insight is that $F_{sk}(pk^r) = g^r$ constitutes a weak PRP over $\mathbb{G}$ based on the DDH assumption.

Twisted ElGamal PKE is as secure and efficient as standard ElGamal. Moreover, it is zero-knowledge proofs friendly, particularly, the state-of-the-art Bulletproofs. We summarize the features of twisted ElGamal as below:

This makes twisted ElGamal extremely useful in numerous privacy-preserving setting. See the document in doc for more details.

By the way, we also implement standard exponent ElGamal PKE for reference.

Specifications

Code Structure

Install OpenSSL (On Linux)

download openssl-master.zip, then

  $ mkdir openssl
  $ mv openssl-master.zip /openssl
  $ unzip openssl-master.zip
  $ cd openssl-master
  $ ./config shared
  $ ./make
  $ ./make test
  $ ./make install

Compile and Run

  $ mkdir build && cd build
  $ cmake ..
  $ make
  $ ./test_twisted_elgamal && ./test_elgamal

Parameter choices

APIs of Twisted ElGamal (single thread)

We also provide parallel implementations, whose Enc, Dec, Scalar performances are better than those in single thread.

Tests


Updates

This library is obsoleted due to the inefficiency of MIRACL and complicated interfaces of OpenSSL. We refer to https://github.com/yuchen1024/Kunlun for a neat and efficient implementation.


License

This library is licensed under the MIT License.