{"id":19390328,"url":"https://github.com/nucypher/nube","last_synced_at":"2025-04-24T00:31:14.386Z","repository":{"id":46408757,"uuid":"379325480","full_name":"nucypher/nube","owner":"nucypher","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-16T01:11:05.000Z","size":43,"stargazers_count":9,"open_issues_count":1,"forks_count":3,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-02T22:33:15.494Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-22T15:56:34.000Z","updated_at":"2024-10-10T14:50:12.000Z","dependencies_parsed_at":"2022-07-22T13:19:25.085Z","dependency_job_id":null,"html_url":"https://github.com/nucypher/nube","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2Fnube","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2Fnube/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2Fnube/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nucypher%2Fnube/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nucypher","download_url":"https://codeload.github.com/nucypher/nube/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250539363,"owners_count":21447294,"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-11-10T10:20:17.522Z","updated_at":"2025-04-24T00:31:13.695Z","avatar_url":"https://github.com/nucypher.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Distributed key generation + proxy re-encryption\n\n[![crate][rust-crate-image]][rust-crate-link] [![Docs][rust-docs-image]][rust-docs-link] ![License][rust-license-image] [![Build Status][rust-build-image]][rust-build-link] [![Coverage][rust-coverage-image]][rust-coverage-link]\n\n`nube` is a Rust implementation of a proxy re-encryption algorithm with distributed key generation.\nSee `notes/dkg.lyx` for the scheme descriptioin.\n\n[rust-crate-image]: https://img.shields.io/crates/v/nube.svg\n[rust-crate-link]: https://crates.io/crates/nube\n[rust-docs-image]: https://docs.rs/nube/badge.svg\n[rust-docs-link]: https://docs.rs/nube/\n[rust-license-image]: https://img.shields.io/crates/l/nube\n[rust-build-image]: https://github.com/nucypher/nube/workflows/nube/badge.svg?branch=main\u0026event=push\n[rust-build-link]: https://github.com/nucypher/nube/actions?query=workflow%3Anube\n[rust-coverage-image]: https://codecov.io/gh/nucypher/nube/branch/main/graph/badge.svg\n[rust-coverage-link]: https://codecov.io/gh/nucypher/nube\n\n\n## Usage example\n\n```rust\nuse nube::{decrypt, encrypt, generate_kfrags, reencrypt, KeyMaker, RecipientSecretKey};\n\n// In this example, we're going to create KeyFrags for a 2-of-3 PRE (T=2, N=3)\nlet threshold = 2;\nlet shares = 3;\n\n//\n// Keymakers\n//\n\n// Let's assume there's a DKG of Ñ=4 keymakers\nlet keymaker1 = KeyMaker::random();\nlet keymaker2 = KeyMaker::random();\nlet keymaker3 = KeyMaker::random();\nlet keymaker4 = KeyMaker::random();\n\n//\n// Encryptor\n//\n\n// Accumulate the encryption key\nlet key_parts = [\n    keymaker1.encryption_key(),\n    keymaker2.encryption_key(),\n    keymaker3.encryption_key(),\n    keymaker4.encryption_key(),\n];\n\nlet encryption_key = \u0026key_parts[0] + \u0026key_parts[1] + \u0026key_parts[2] + \u0026key_parts[3];\n\n// Now, Encryptor encrypts something with the DKG encryption key\n// For simplicity, we don't deal with messages here but only with the computation\n// of the secret factor used to derive the symmetric key that encrypts the message\n// TODO: use the symmetric key to encrypt a ciphertext.\nlet (capsule, symmetric_key) = encrypt(\u0026encryption_key);\n\n//\n// Recipient\n//\n\n// Recipient creates a secret key for decryption,\n// and a public key that will be a target for keyslivers/keyfrags.\nlet recipient_sk = RecipientSecretKey::random();\nlet recipient_pk = recipient_sk.public_key();\n\n//\n// Author\n//\n\n// Author creates a label and sends it to Keymakers, requesting key slivers\nlet label = b\"some label\";\n\n// Keymakers make key slivers intended for Recipient\nlet ksliver1 = keymaker1.make_key_sliver(label, \u0026recipient_pk, threshold, shares);\nlet ksliver2 = keymaker2.make_key_sliver(label, \u0026recipient_pk, threshold, shares);\nlet ksliver3 = keymaker3.make_key_sliver(label, \u0026recipient_pk, threshold, shares);\nlet ksliver4 = keymaker4.make_key_sliver(label, \u0026recipient_pk, threshold, shares);\n\n// The slivers are sent back to the Author who repackages them into kfrags.\nlet kfrags = generate_kfrags(\u0026[ksliver1, ksliver2, ksliver3, ksliver4]).unwrap();\n\n//\n// Proxies\n//\n\n// Proxies reencrypt the keyfrags.\nlet cfrag0 = reencrypt(\u0026capsule, \u0026kfrags[0]);\nlet _cfrag1 = reencrypt(\u0026capsule, \u0026kfrags[1]);\nlet cfrag2 = reencrypt(\u0026capsule, \u0026kfrags[2]);\n\n//\n// Recipient\n//\n\n// Recipient decryptis with 2 out of 3 cfrags\nlet decrypted_key = decrypt(\u0026recipient_sk, \u0026[cfrag0, cfrag2]).unwrap();\n\nassert_eq!(symmetric_key, decrypted_key);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucypher%2Fnube","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnucypher%2Fnube","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnucypher%2Fnube/lists"}