pyUmbral/README.rst

101 lines
2.9 KiB
ReStructuredText
Raw Normal View History

.. role:: bash(code)
:language: bash
=========
2018-02-16 19:27:36 +00:00
pyUmbral
=========
.. image:: https://travis-ci.org/nucypher/pyUmbral.svg?branch=master
:target: https://travis-ci.org/nucypher/pyUmbral
2018-02-16 19:27:36 +00:00
2018-03-18 01:44:58 +00:00
pyUmbral is a python implementation of David Nuñez's threshold proxy re-encryption scheme: Umbral_.
Implemented with OpenSSL_ and Cryptography.io_, pyUmbral is a referential and open-source cryptography library
extending the traditional cryptological narrative of "Alice and Bob" by introducing a new actor,
*Ursula*, who has the ability to take secrets encrypted for Alice and *re-encrypt* them for Bob.
2018-02-16 19:27:36 +00:00
.. _Umbral: https://github.com/nucypher/umbral-doc/blob/master/umbral-doc.pdf
.. _Cryptography.io: https://cryptography.io/en/latest/
.. _OpenSSL: https://www.openssl.org/
**Encryption**
2018-02-16 19:27:36 +00:00
.. code-block:: python
2018-02-16 19:27:36 +00:00
2018-03-21 05:45:27 +00:00
from umbral import pre, keys
2018-02-16 19:27:36 +00:00
# Generate umbral keys for Alice.
alices_private_key = keys.UmbralPrivateKey.gen_key()
2018-03-21 05:45:27 +00:00
alices_public_key = alices_private_key.get_pubkey()
2018-02-16 19:27:36 +00:00
# Encrypt data with Alice's public key.
2018-02-16 19:27:36 +00:00
plaintext = b'Proxy Re-encryption is cool!'
2018-03-21 05:45:27 +00:00
ciphertext, capsule = pre.encrypt(alices_public_key, plaintext)
# Decrypt data with Alice's private key.
2018-03-21 05:45:27 +00:00
cleartext = pre.decrypt(capsule, alices_private_key,
ciphertext, alices_public_key)
**Fragmentation**
.. code-block:: python
2018-02-16 19:27:36 +00:00
# Generate umbral keys for Bob.
bobs_private_key = keys.UmbralPrivateKey.gen_key()
2018-03-21 05:45:27 +00:00
bobs_public_key = bobs_private_key.get_pubkey()
# Alice generates split re-encryption keys for Bob with "M of N".
2018-03-21 05:45:27 +00:00
kfrags = pre.split_rekey(alices_private_key, bobs_public_key, 10, 20)
**Re-encryption**
.. code-block:: python
# Ursula re-encrypts the capsule to obtain a cfrag.
# Bob attaches the cfrags to the capsule.
for kfrag in kfrags:
2018-03-21 05:45:27 +00:00
cfrag = pre.reencrypt(kfrag, capsule)
capsule.attach_cfrag(cfrag)
2018-02-16 19:27:36 +00:00
# Bob activates and opens the capsule.
2018-03-21 05:45:27 +00:00
cleartext = pre.decrypt(capsule, bobs_private_key,
ciphertext, alices_public_key)
2018-02-16 19:27:36 +00:00
Quick Installation
==================
2018-02-16 19:27:36 +00:00
The NuCypher team uses pipenv for managing pyUmbral's dependencies.
The recommended installation procedure is as follows:
.. code-block:: bash
2018-02-16 19:27:36 +00:00
$ sudo pip3 install pipenv
$ pipenv install
2018-02-16 19:27:36 +00:00
2018-03-18 01:44:58 +00:00
Post-installation, you can activate the project virtual environment
in your current terminal session by running :bash:`pipenv shell`.
2018-02-16 19:27:36 +00:00
For more information on pipenv, find the official documentation here: https://docs.pipenv.org/.
2018-02-16 19:27:36 +00:00
Academic Whitepaper
====================
The Umbral scheme academic whitepaper and cryptographic specifications
2018-03-18 01:44:58 +00:00
are available on GitHub_.
"Umbral: A Threshold Proxy Re-Encryption Scheme"
*by David Nuñez*
https://github.com/nucypher/umbral-doc/blob/master/umbral-doc.pdf
.. _GitHub: https://github.com/nucypher/umbral-doc/
2018-02-16 19:27:36 +00:00
Support & Contribute
=====================
2018-02-16 19:27:36 +00:00
- Issue Tracker: https://github.com/nucypher/pyUmbral/issues
- Source Code: https://github.com/nucypher/pyUmbral