Go to file
David Núñez e020e1ac1e
Merge pull request #221 from KPrasch/deployment-test
Pre-deployment testing and acceptance for PyPI releases
2018-10-15 20:03:16 +02:00
.circleci Include deployment testing steps and manual approval for PyPI 2018-10-15 09:55:41 -07:00
docs Some type annotation improvements and other minor change requests 2018-10-11 21:01:21 +02:00
tests Some type annotation improvements and other minor change requests 2018-10-11 21:01:21 +02:00
umbral Some type annotation improvements and other minor change requests 2018-10-11 21:01:21 +02:00
vectors Rename pre.split_rekey to pre.generate_kfrags. Introduce changes in args 2018-10-06 19:00:34 +02:00
.bumpversion.cfg Bump version: 0.1.0-alpha.3 → 0.1.0-alpha.4 2018-08-21 14:33:15 -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 Get constant sorrow from pipy 2018-10-11 21:01:26 +02:00
Pipfile.lock Adds support to testing Jupyter notebooks with py.test plugin nbval 2018-10-06 22:28:14 +02:00
README.rst Updating README, scripts and notebook to latest changes in the API 2018-10-06 22:28:07 +02:00
mypy.ini Tone-down mypy checks 2018-07-09 12:13:41 -06:00
requirements-dev.txt Add requirements files based on Pipfile.lock 2018-08-18 20:25:28 -07:00
requirements.txt Add requirements files based on Pipfile.lock 2018-08-18 20:25:28 -07:00
setup.py Add required packaging metadata: pass setup.py check 2018-08-20 15:25: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
=========
v0.1.0-alpha.4

.. image:: https://circleci.com/gh/nucypher/pyUmbral/tree/master.svg?style=svg
    :target: https://circleci.com/gh/nucypher/pyUmbral/tree/master

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/

Usage
=====

**Key Generation**

.. code-block:: python

    from umbral import pre, keys, signing

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

    alices_signing_key = keys.UmbralPrivateKey.gen_key()
    alices_verifying_key = alices_signing_key.get_pubkey()
    alices_signer = signing.Signer(private_key=alices_signing_key)

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


**Encryption**

.. code-block:: python

    # 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=ciphertext, 
                            capsule=capsule, 
                            decrypting_key=alices_private_key)


**Re-Encryption Key Fragments**

.. code-block:: python

    # Alice generates "M of N" re-encryption key fragments (or "KFrags") for Bob.
    # In this example, 10 out of 20.
    kfrags = pre.generate_kfrags(delegating_privkey=alices_private_key,
                                 signer=alices_signer,
                                 receiving_pubkey=bobs_public_key,
                                 threshold=10,
                                 N=20)


**Re-Encryption**

.. code-block:: python

  # Several Ursulas perform re-encryption, and Bob collects the resulting `cfrags`.
  # He must gather at least `threshold` `cfrags` in order to activate the capsule.

  capsule.set_correctness_keys(delegating=alices_public_key,
                               receiving=bobs_public_key,
                               verifying=alices_verifying_key)

  cfrags = list()           # Bob's cfrag collection
  for kfrag in kfrags[:10]:
    cfrag = pre.reencrypt(kfrag=kfrag, capsule=capsule)
    cfrags.append(cfrag)    # Bob collects a cfrag


**Decryption by Bob**

.. code-block:: python

  # Bob activates and opens the capsule
  for cfrag in cfrags:
    capsule.attach_cfrag(cfrag)

  bob_cleartext = pre.decrypt(ciphertext=ciphertext, 
                              capsule=capsule, 
                              decrypting_key=bobs_private_key)
  assert bob_cleartext == plaintext

See more detailed usage examples in the docs_ directory.

.. _docs : https://github.com/nucypher/pyUmbral/tree/master/docs


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.