Skip to main content

A Python binding for the RELIC cryptographic library

Project description

petrelic is a Python wrapper around RELIC. It provides a simple python interface to the BLS-381 pairing and RELIC’s big number class. Our goals is to make it easy to prototype new cryptographic applications in Python using RELIC as the backend. In the future we aim to support a few other pairing curves as well.

petrelic provides native, multiplicative and additive interfaces to RELIC. You can use the one that you find most comfortable. petrelic overloads Python’s binary operators to make computation with pairings easy. For example, here is how you would compute and verify a BLS signature using the multiplicative interface:

>>> from petrelic.multiplicative.pairing import G1, G2, GT
>>> sk = G1.order().random()
>>> pk = G2.generator() ** sk

>>> # Create the signature
>>> m = b"Some message"
>>> signature = G1.hash_to_point(m) ** sk

>>> # Verify the signature
>>> signature.pair(G2.generator()) == G1.hash_to_point(m).pair(pk)
True

You can find more information in the documentation.

You can install petrelic on Linux using:

$ pip install petrelic

For full details see the installation documentation.

Warning

Please don’t use this software for anything mission-critical. It is designed for rapid prototyping of cryptographic primitives using RELIC. We offer no guarantees that the petrelic bindings are secure. We echo RELIC own warning: “RELIC is at most alpha-quality software. Implementations may not be correct or secure and may include patented algorithms. … Use at your own risk.”

Project details


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for petrelic, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size petrelic-0.1.0-cp36-cp36m-manylinux1_x86_64.whl (774.8 kB) File type Wheel Python version cp36 Upload date Hashes View
Filename, size petrelic-0.1.0-cp37-cp37m-manylinux1_x86_64.whl (719.3 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size petrelic-0.1.0-cp38-cp38-manylinux1_x86_64.whl (776.4 kB) File type Wheel Python version cp38 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page