{"id":13775767,"url":"https://github.com/nucypher/pyumbral","last_synced_at":"2025-04-04T14:08:01.751Z","repository":{"id":44866916,"uuid":"115219228","full_name":"nucypher/pyUmbral","owner":"nucypher","description":"NuCypher's reference implementation of Umbral (threshold proxy re-encryption) using OpenSSL and Cryptography.io","archived":false,"fork":false,"pushed_at":"2022-12-09T05:18:10.000Z","size":7003,"stargazers_count":288,"open_issues_count":16,"forks_count":71,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-28T13:08:56.493Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pyumbral.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nucypher.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-23T20:10:04.000Z","updated_at":"2025-02-06T07:16:38.000Z","dependencies_parsed_at":"2023-01-25T11:02:00.693Z","dependency_job_id":null,"html_url":"https://github.com/nucypher/pyUmbral","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2FpyUmbral","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2FpyUmbral/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2FpyUmbral/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2FpyUmbral/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nucypher","download_url":"https://codeload.github.com/nucypher/pyUmbral/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190251,"owners_count":20898702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T17:01:49.070Z","updated_at":"2025-04-04T14:08:01.730Z","avatar_url":"https://github.com/nucypher.png","language":"Python","funding_links":[],"categories":["\u003ca id=\"d03d494700077f6a65092985c06bf8e8\"\u003e\u003c/a\u003e工具","Roadmap"],"sub_categories":["\u003ca id=\"0ff94312f3ab4898f5996725133ea9d1\"\u003e\u003c/a\u003e未分类"],"readme":".. role:: bash(code)\n   :language: bash\n\n=========\npyUmbral\n=========\n\n.. start-badges\n\n|version|  |circleci| |commits-since| |docs| |discord|\n\n.. |docs| image:: https://readthedocs.org/projects/pyumbral/badge/?style=flat\n    :target: https://readthedocs.org/projects/pyumbral\n    :alt: Documentation Status\n\n.. |discord| image:: https://img.shields.io/discord/411401661714792449.svg?logo=discord\n    :target: https://discord.gg/xYqyEby\n    :alt: Discord\n\n.. |circleci| image:: https://img.shields.io/circleci/project/github/nucypher/pyUmbral.svg?logo=circleci\n    :target: https://circleci.com/gh/nucypher/pyUmbral/tree/master\n    :alt: CircleCI build status\n\n.. |version| image:: https://img.shields.io/pypi/v/umbral.svg\n    :alt: PyPI Package latest release\n    :target: https://pypi.org/project/umbral\n\n.. |commits-since| image:: https://img.shields.io/github/commits-since/nucypher/pyumbral/v0.3.0.svg\n    :alt: Commits since latest release\n    :target: https://github.com/nucypher/pyUmbral/compare/v0.3.0...master\n\n.. end-badges\n\npyUmbral is the reference implementation of the Umbral_ threshold proxy re-encryption scheme.\nIt is open-source, built with Python, and uses OpenSSL_ and Cryptography.io_.\n\nUsing Umbral, Alice (the data owner) can *delegate decryption rights* to Bob for\nany ciphertext intended to her, through a re-encryption process performed by a\nset of semi-trusted proxies or *Ursulas*. When a threshold of these proxies\nparticipate by performing re-encryption, Bob is able to combine these independent\nre-encryptions and decrypt the original message using his private key.\n\n.. image:: docs/source/.static/umbral.svg\n  :width: 400 px\n  :align: center\n\npyUmbral is the cryptographic engine behind nucypher_,\na proxy re-encryption network to empower privacy in decentralized systems.\n\n.. _Umbral: https://github.com/nucypher/umbral-doc/blob/master/umbral-doc.pdf\n.. _Cryptography.io: https://cryptography.io/en/latest/\n.. _OpenSSL: https://www.openssl.org/\n.. _nucypher: https://github.com/nucypher/nucypher\n\nUsage\n=====\n\n**Key Generation**\n\nAs in any public-key cryptosystem, users need a pair of public and private keys.\nAdditionally, users that delegate access to their data (like Alice, in this example) need a signing keypair.\n\n.. code-block:: python\n\n    from umbral import SecretKey, Signer\n\n    # Generate Umbral keys for Alice.\n    alices_secret_key = SecretKey.random()\n    alices_public_key = alices_secret_key.public_key()\n\n    alices_signing_key = SecretKey.random()\n    alices_signer = Signer(alices_signing_key)\n    alices_verifying_key = alices_signing_key.public_key()\n\n    # Generate Umbral keys for Bob.\n    bobs_secret_key = SecretKey.random()\n    bobs_public_key = bobs_secret_key.public_key()\n\n\n**Encryption**\n\nNow let's encrypt data with Alice's public key.\nInvocation of ``pre.encrypt`` returns both the ``ciphertext`` and a ``capsule``.\nNote that anyone with Alice's public key can perform this operation.\n\nSince data was encrypted with Alice's public key,\nAlice can open the capsule and decrypt the ciphertext with her private key.\n\n\n.. code-block:: python\n\n    from umbral import encrypt, decrypt_original\n\n    # Encrypt data with Alice's public key.\n    plaintext = b'Proxy Re-Encryption is cool!'\n    capsule, ciphertext = encrypt(alices_public_key, plaintext)\n\n    # Decrypt data with Alice's private key.\n    cleartext = decrypt_original(alices_secret_key, capsule, ciphertext)\n\n\n**Re-Encryption Key Fragments**\n\nWhen Alice wants to grant Bob access to open her encrypted messages,\nshe creates *re-encryption key fragments*, or *\"kfrags\"*,\nwhich are next sent to N proxies or *Ursulas*.\n\n.. code-block:: python\n\n    from umbral import generate_kfrags\n\n    # Alice generates \"M of N\" re-encryption key fragments (or \"KFrags\") for Bob.\n    # In this example, 10 out of 20.\n    kfrags = generate_kfrags(delegating_sk=alices_secret_key,\n                             receiving_pk=bobs_public_key,\n                             signer=alices_signer,\n                             threshold=10,\n                             shares=20)\n\n\n**Re-Encryption**\n\nBob asks several Ursulas to re-encrypt the capsule so he can open it.\nEach Ursula performs re-encryption on the capsule using the ``kfrag``\nprovided by Alice, obtaining this way a \"capsule fragment\", or ``cfrag``.\n\nBob collects the resulting cfrags from several Ursulas.\nBob must gather at least ``threshold`` cfrags in order to activate the capsule.\n\n.. code-block:: python\n\n    from umbral import reencrypt\n\n    # Several Ursulas perform re-encryption, and Bob collects the resulting `cfrags`.\n    cfrags = list()           # Bob's cfrag collection\n    for kfrag in kfrags[:10]:\n        cfrag = pre.reencrypt(capsule=capsule, kfrag=kfrag)\n        cfrags.append(cfrag)    # Bob collects a cfrag\n\n\n**Decryption by Bob**\n\nFinally, Bob activates the capsule by attaching at least ``threshold`` cfrags,\nand then decrypts the re-encrypted ciphertext.\n\n.. code-block:: python\n\n    from umbral import decrypt_reencrypted\n\n    bob_cleartext = pre.decrypt_reencrypted(receiving_sk=bobs_secret_key,\n                                            delegating_pk=alices_public_key,\n                                            capsule=capsule,\n                                            cfrags=cfrags,\n                                            ciphertext=ciphertext)\n    assert bob_cleartext == plaintext\n\nSee more detailed usage examples in the docs_ directory.\n\n.. _docs : https://github.com/nucypher/pyUmbral/tree/master/docs\n\n\nQuick Installation\n==================\n\nTo install pyUmbral, simply use ``pip``:\n\n.. code-block:: bash\n\n  $ pip3 install umbral\n\n\nAlternatively, you can checkout the repo and install it from there.\nThe NuCypher team uses ``pipenv`` for managing pyUmbral's dependencies.\nThe recommended installation procedure is as follows:\n\n.. code-block:: bash\n\n    $ sudo pip3 install pipenv\n    $ pipenv install\n\nPost-installation, you can activate the project virtual environment\nin your current terminal session by running ``pipenv shell``.\n\nFor more information on ``pipenv``, find the official documentation here: https://docs.pipenv.org/.\n\n\nAcademic Whitepaper\n====================\n\nThe Umbral scheme academic whitepaper and cryptographic specifications\nare available on GitHub_.\n\n  \"Umbral: A Threshold Proxy Re-Encryption Scheme\"\n  *by David Nuñez*.\n  https://github.com/nucypher/umbral-doc/blob/master/umbral-doc.pdf\n\n.. _GitHub: https://github.com/nucypher/umbral-doc/\n\n\nSupport \u0026 Contribute\n=====================\n\n- Issue Tracker: https://github.com/nucypher/pyUmbral/issues\n- Source Code: https://github.com/nucypher/pyUmbral\n\n\nSecurity\n========\n\nIf you identify vulnerabilities with _any_ nucypher code,\nplease email security@nucypher.com with relevant information to your findings.\nWe will work with researchers to coordinate vulnerability disclosure between our partners\nand users to ensure successful mitigation of vulnerabilities.\n\nThroughout the reporting process,\nwe expect researchers to honor an embargo period that may vary depending on the severity of the disclosure.\nThis ensures that we have the opportunity to fix any issues, identify further issues (if any), and inform our users.\n\nSometimes vulnerabilities are of a more sensitive nature and require extra precautions.\nWe are happy to work together to use a more secure medium, such as Signal.\nEmail security@nucypher.com and we will coordinate a communication channel that we're both comfortable with.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucypher%2Fpyumbral","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnucypher%2Fpyumbral","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucypher%2Fpyumbral/lists"}