Go to file
Kieran Prasch 19b1991de6 Hand-picked type data to follow-up monkeytype 2018-07-09 12:26:32 -06:00
.circleci Fix PEP 508 markers 2018-07-06 13:46:10 -07:00
docs Update python notebook example 2018-07-09 11:12:04 -06:00
tests Use singleton model for curves; allow users to import instances 2018-07-07 13:56:07 -06:00
umbral Hand-picked type data to follow-up monkeytype 2018-07-09 12:26:32 -06:00
wheelhouse Add python 3.7 support. 2018-07-06 13:27:06 -07:00
.coveragerc Update circle yml; fix pipenv support, store coverage results as html 2018-06-25 13:08:12 -07:00
.gitignore Hand-picked type data to follow-up monkeytype 2018-07-09 12:26:32 -06:00
LICENSE.md Add GPLv3 license, this software is Free as in Freedom. 2018-03-21 13:26:12 -06:00
Pipfile Fix PEP 508 markers 2018-07-06 13:46:10 -07:00
Pipfile.lock Fix PEP 508 markers 2018-07-06 13:46:10 -07:00
README.rst Fix old Readme code 2018-05-23 12:52:40 +02:00
mypy.ini Tone-down mypy checks 2018-07-09 12:13:41 -06:00
setup.py Removing cryptography.io from setup.py; using python markers in Pipfile to use wheels. 2018-05-01 16:36:24 -07:00

README.rst

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

.. role:: bash(code)
   :language: bash

=========
pyUmbral
=========

.. image:: https://travis-ci.org/nucypher/pyUmbral.svg?branch=master
    :target: https://travis-ci.org/nucypher/pyUmbral

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.

.. _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**

.. code-block:: python

    from umbral import pre, keys

    # Generate umbral keys for Alice.
    alices_private_key = keys.UmbralPrivateKey.gen_key()
    alices_public_key = alices_private_key.get_pubkey()

    # Encrypt data with Alice's public key.
    plaintext = b'Proxy Re-encryption is cool!'
    ciphertext, capsule = pre.encrypt(alices_public_key, plaintext)

    # Decrypt data with Alice's private key.
    cleartext = pre.decrypt(ciphertext, capsule, 
                            alices_private_key, alices_public_key)

**Fragmentation**

.. code-block:: python

    # Generate umbral keys for Bob.
    bobs_private_key = keys.UmbralPrivateKey.gen_key()
    bobs_public_key = bobs_private_key.get_pubkey()

    # Alice generates split re-encryption keys for Bob with "M of N".
    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:
      cfrag = pre.reencrypt(kfrag, capsule)
      capsule.attach_cfrag(cfrag)

  # Bob activates and opens the capsule.
  cleartext = pre.decrypt(ciphertext, capsule, 
                          bobs_private_key, alices_public_key)


Quick Installation
==================

The NuCypher team uses pipenv for managing pyUmbral's dependencies.
The recommended installation procedure is as follows:

.. code-block:: bash

    $ sudo pip3 install pipenv
    $ pipenv install

Post-installation, you can activate the project virtual environment
in your current terminal session by running :bash:`pipenv shell`.

For more information on pipenv, find the official documentation here: https://docs.pipenv.org/.


Academic Whitepaper
====================

The Umbral scheme academic whitepaper and cryptographic specifications
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/


Support & Contribute
=====================

- Issue Tracker: https://github.com/nucypher/pyUmbral/issues
- Source Code: https://github.com/nucypher/pyUmbral

OFAC Sanctions Disclaimer
=========================

By using this software, you hereby affirm you are not an individual or entity subject to economic sanctions administered by the U.S. Government or any other applicable authority, including but not limited to, sanctioned party lists administered by the U.S. Treasury Departments Office of Foreign Assets Control (OFAC), the U.S. State Department, and the U.S. Commerce Department.  You further affirm you are not located in, or ordinarily resident in, any country, territory or region subject to comprehensive economic sanctions administered by OFAC, which are subject to change but currently include Cuba, Iran, North Korea, Syria and the Crimea region.