python-relic (pyrelic for short) provides Python bindings for
relic. Note though, that the bindings are driven by my
personal needs and they do not cover the full relic API.
pyrelic requires the following dependencies to successfully build and install:
relic >= 0.5.0with pairing support enabled.Cython >= 0.28(optional, only for building). If Cython is not available, the C files are not regenerated from their source.pkgconfig(optional, only for building). Ifpkgconfigis not available, the build system assumes thatreliccan be linked as-lrelic.
If you are running Ubuntu 20.04, the easiest way to install pyrelic is via my
PPA:
sudo add-apt-repository -u ppa:s-ramacher/ait
sudo apt install python3-pyrelicIt comes with a pre-built version of relic configured for the pairing-friendly BLS12-381 curve.
Otherwise, pyrelic can be installed via pip:
pip install python-relicor by running:
python3 setup.py installNote though that these two approaches require a pairing-enabled build of relic to be available.
pyrelic includes some examples that demonstrate the use of the module and also showcases some
pairing-based schemes:
examples/bls.py: Implements the Boneh-Lynn-Shacham signature scheme.examples/bfibe.py: Implements the Boneh-Franklin identity-based encryption scheme (BasicIdent).examples/hpra.py: Implements homomorphic proxy re-authenticators for linear functions.examples/bfe.py: Implements Bloom Filter KEM based on the BF IBE.examples/spseq.py: Implements a structure-preserving signature scheme on equivalence classes.examples/chac: Implements core/helper anonymous credentials.
The code is licensed under the MIT license and was written by Sebastian Ramacher (AIT Austrian Institute of Technology).
This work has been partially funded by the European Union’s Horizon 2020 research and innovation programme under grant agreement No 871473 (KRAKEN) and by ECSEL Joint Undertaking under grant agreement No 826610 (Comp4Drones).