2018-02-16 20:47:38 +00:00
|
|
|
.. role:: bash(code)
|
|
|
|
:language: bash
|
|
|
|
|
2018-02-17 05:03:24 +00:00
|
|
|
=========
|
2018-02-16 19:27:36 +00:00
|
|
|
pyUmbral
|
2018-02-17 05:03:24 +00:00
|
|
|
=========
|
2018-02-16 20:47:38 +00:00
|
|
|
|
2018-02-16 19:31:41 +00:00
|
|
|
.. 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-02-17 06:30:28 +00:00
|
|
|
pyUmbral is a python implementation of Umbral using OpenSSL and Cryptography.io,
|
2018-02-17 00:17:13 +00:00
|
|
|
enabling users to perform *split-key proxy-rencryption* and public key encryption
|
2018-02-17 05:03:24 +00:00
|
|
|
in an understandable and usable manner.
|
2018-02-16 19:27:36 +00:00
|
|
|
|
2018-02-18 00:24:02 +00:00
|
|
|
**Public Key Encryption**
|
2018-02-16 19:27:36 +00:00
|
|
|
|
2018-02-16 20:47:38 +00:00
|
|
|
.. code-block:: python
|
2018-02-16 19:27:36 +00:00
|
|
|
|
|
|
|
from umbral import umbral, keys
|
|
|
|
|
2018-02-18 00:24:02 +00:00
|
|
|
# Generate umbral keys for Alice.
|
2018-02-16 20:47:38 +00:00
|
|
|
alices_private_key = keys.UmbralPrivateKey.gen_key()
|
|
|
|
alices_public_key = private_key.get_pubkey()
|
2018-02-16 19:27:36 +00:00
|
|
|
|
2018-02-18 00:24:02 +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-02-16 20:47:38 +00:00
|
|
|
ciphertext, capsule = umbral.encrypt(alices_public_key, plaintext)
|
|
|
|
|
2018-02-18 00:24:02 +00:00
|
|
|
# Decrypt data with Alice's private key.
|
|
|
|
cleartext = umbral.decrypt(capsule, alices_private_key,
|
|
|
|
ciphertext, alices_public_key)
|
2018-02-16 20:47:38 +00:00
|
|
|
|
2018-02-18 00:24:02 +00:00
|
|
|
**Generate Split Re-Encryption Keys**
|
2018-02-16 20:47:38 +00:00
|
|
|
|
|
|
|
.. code-block:: python
|
2018-02-16 19:27:36 +00:00
|
|
|
|
2018-02-18 00:24:02 +00:00
|
|
|
# Generate umbral keys for Bob.
|
2018-02-16 20:47:38 +00:00
|
|
|
bobs_private_key = keys.UmbralPrivateKey.gen_key()
|
|
|
|
bobs_public_key = private_key.get_pubkey()
|
|
|
|
|
2018-02-18 00:24:02 +00:00
|
|
|
# Generate split re-encryption keys with "M of N".
|
2018-02-16 20:47:38 +00:00
|
|
|
kfrags, _ = umbral.split_rekey(alices_private_key, bobs_public_key, 10, 20)
|
|
|
|
|
|
|
|
|
2018-02-18 00:24:02 +00:00
|
|
|
**Proxy Re-encryption**
|
|
|
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
# Ursula exchanges key fragments with Bob.
|
|
|
|
# Bob attaches the cfrags to the capsule.
|
|
|
|
for kfrag in kfrags:
|
|
|
|
cfrag = umbral.reencrypt(kfrag, capsule)
|
|
|
|
capsule.attach_cfrag(cfrag)
|
2018-02-16 19:27:36 +00:00
|
|
|
|
2018-02-18 00:24:02 +00:00
|
|
|
# Bob activates and opens the capsule.
|
|
|
|
cleartext = umbral.decrypt(capsule, bobs_private_key,
|
|
|
|
ciphertext, alices_public_key)
|
2018-02-16 19:27:36 +00:00
|
|
|
|
2018-02-17 05:03:24 +00:00
|
|
|
|
|
|
|
Features
|
|
|
|
==========
|
2018-02-17 06:30:28 +00:00
|
|
|
- Proxy Re-encryption
|
2018-02-20 03:05:20 +00:00
|
|
|
- Threshold Proxy Re-encryption Key Splitting
|
|
|
|
- Data and Key Encapsulation
|
2018-02-17 06:30:28 +00:00
|
|
|
- Public Key Encryption & Decryption
|
2018-02-17 05:03:24 +00:00
|
|
|
|
|
|
|
|
2018-02-16 23:52:24 +00:00
|
|
|
Quick Installation
|
2018-02-17 05:03:24 +00:00
|
|
|
==================
|
2018-02-16 19:27:36 +00:00
|
|
|
|
|
|
|
The NuCypher team uses pipenv for managing pyUmbral's dependencies.
|
2018-02-16 23:52:24 +00:00
|
|
|
The recommended installation procedure is as follows:
|
2018-02-16 20:47:38 +00:00
|
|
|
|
|
|
|
.. code-block:: bash
|
2018-02-16 19:27:36 +00:00
|
|
|
|
2018-02-16 20:47:38 +00:00
|
|
|
$ sudo pip3 install pipenv
|
|
|
|
$ pipenv install
|
2018-02-16 19:27:36 +00:00
|
|
|
|
|
|
|
Post-installation, you can activate the project virtual enviorment
|
2018-02-16 20:47:38 +00:00
|
|
|
in your current terminal session by running :bash:`pipenv shell`.
|
2018-02-16 19:27:36 +00:00
|
|
|
|
2018-02-16 23:52:24 +00:00
|
|
|
For more information on pipenv, find the official documentation here: https://docs.pipenv.org/.
|
2018-02-16 19:27:36 +00:00
|
|
|
|
2018-02-17 00:17:13 +00:00
|
|
|
|
2018-02-20 03:05:20 +00:00
|
|
|
Technical Documentation
|
2018-02-17 05:03:24 +00:00
|
|
|
========================
|
2018-02-17 00:17:13 +00:00
|
|
|
"Umbral: A Threshold Proxy Re-Encryption Scheme"
|
|
|
|
by David Nuñez
|
|
|
|
|
|
|
|
Technical documentation and cryptographic specifications
|
2018-02-17 05:03:24 +00:00
|
|
|
are availible on GitHub https://github.com/nucypher/umbral-doc/blob/master/umbral-doc.pdf
|
2018-02-17 00:17:13 +00:00
|
|
|
|
|
|
|
|
2018-02-16 19:27:36 +00:00
|
|
|
Support & Contribute
|
2018-02-17 05:03:24 +00:00
|
|
|
=====================
|
2018-02-16 19:27:36 +00:00
|
|
|
|
2018-02-16 23:52:24 +00:00
|
|
|
- Issue Tracker: https://github.com/nucypher/pyUmbral/issues
|
2018-02-17 00:17:13 +00:00
|
|
|
- Source Code: https://github.com/nucypher/pyUmbral
|