{"id":13531364,"url":"https://github.com/RustCrypto/RSA","last_synced_at":"2025-04-01T19:31:55.761Z","repository":{"id":37602670,"uuid":"141327028","full_name":"RustCrypto/RSA","owner":"RustCrypto","description":"RSA implementation in pure Rust","archived":false,"fork":false,"pushed_at":"2024-10-08T01:01:43.000Z","size":639,"stargazers_count":546,"open_issues_count":23,"forks_count":152,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-10-29T16:20:44.801Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RustCrypto.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-17T18:15:35.000Z","updated_at":"2024-10-24T13:58:45.000Z","dependencies_parsed_at":"2023-10-26T17:24:43.429Z","dependency_job_id":"5d596d19-84ab-4710-ab72-05a9cf583c6b","html_url":"https://github.com/RustCrypto/RSA","commit_stats":{"total_commits":320,"total_committers":53,"mean_commits":6.037735849056604,"dds":0.68125,"last_synced_commit":"8797ee20fdb7427ca8fe5e7868da31a688fb7cbb"},"previous_names":[],"tags_count":38,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustCrypto%2FRSA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustCrypto%2FRSA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustCrypto%2FRSA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RustCrypto%2FRSA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RustCrypto","download_url":"https://codeload.github.com/RustCrypto/RSA/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246473279,"owners_count":20783236,"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-01T07:01:02.379Z","updated_at":"2025-04-01T19:31:55.745Z","avatar_url":"https://github.com/RustCrypto.png","language":"Rust","funding_links":[],"categories":["Rust","Cryptography"],"sub_categories":["Asymmetric Cryptography"],"readme":"# [RustCrypto]: RSA\n\n[![crates.io][crate-image]][crate-link]\n[![Documentation][doc-image]][doc-link]\n[![Build Status][build-image]][build-link]\n[![dependency status][deps-image]][deps-link]\n![MSRV][msrv-image]\n[![Project Chat][chat-image]][chat-link]\n\nA portable RSA implementation in pure Rust.\n\n## Example\n\n```rust\nuse rsa::{Pkcs1v15Encrypt, RsaPrivateKey, RsaPublicKey};\n\nlet mut rng = rand::thread_rng();\nlet bits = 2048;\nlet priv_key = RsaPrivateKey::new(\u0026mut rng, bits).expect(\"failed to generate a key\");\nlet pub_key = RsaPublicKey::from(\u0026priv_key);\n\n// Encrypt\nlet data = b\"hello world\";\nlet enc_data = pub_key.encrypt(\u0026mut rng, Pkcs1v15Encrypt, \u0026data[..]).expect(\"failed to encrypt\");\nassert_ne!(\u0026data[..], \u0026enc_data[..]);\n\n// Decrypt\nlet dec_data = priv_key.decrypt(Pkcs1v15Encrypt, \u0026enc_data).expect(\"failed to decrypt\");\nassert_eq!(\u0026data[..], \u0026dec_data[..]);\n```\n\n\u003e **Note:** If you encounter unusually slow key generation time while using `RsaPrivateKey::new` you can try to compile in release mode or add the following to your `Cargo.toml`. Key generation is much faster when building with higher optimization levels, but this will increase the compile time a bit.\n\u003e ```toml\n\u003e [profile.debug]\n\u003e opt-level = 3\n\u003e ```\n\u003e If you don't want to turn on optimizations for all dependencies,\n\u003e you can only optimize the `num-bigint-dig` dependency. This should\n\u003e give most of the speedups.\n\u003e ```toml\n\u003e [profile.dev.package.num-bigint-dig]\n\u003e opt-level = 3\n\u003e ```\n\n## Status\n\nCurrently at Phase 1 (v) 🚧\n\nThere will be three phases before `1.0` 🚢 can be released.\n\n1. 🚧  Make it work\n    - [x] Prime generation ✅\n    - [x] Key generation ✅\n    - [x] PKCS1v1.5: Encryption \u0026 Decryption ✅\n    - [x] PKCS1v1.5: Sign \u0026 Verify ✅\n    - [ ] PKCS1v1.5 (session key): Encryption \u0026 Decryption\n    - [x] OAEP: Encryption \u0026 Decryption\n    - [x] PSS: Sign \u0026 Verify\n    - [x] Key import \u0026 export\n2. 🚀 Make it fast\n    - [x] Benchmarks ✅\n    - [ ] compare to other implementations 🚧\n    - [ ] optimize 🚧\n3. 🔐 Make it secure\n    - [ ] Fuzz testing\n    - [ ] Security Audits\n\n## ⚠️Security Warning\n\nThis crate has received one [security audit by Include Security][audit], with\nonly one minor finding which has since been addressed.\n\nSee the [open security issues] on our issue tracker for other known problems.\n\n~~Notably the implementation of [modular exponentiation is not constant time],\nbut timing variability is masked using [random blinding], a commonly used\ntechnique.~~ This crate is vulnerable to the [Marvin Attack] which could enable\nprivate key recovery by a network attacker (see [RUSTSEC-2023-0071]).\n\nYou can follow our work on mitigating this issue in [#390].\n\n## Minimum Supported Rust Version (MSRV)\n\nThis crate supports Rust 1.83 or higher.\n\nIn the future MSRV can be changed, but it will be done with a minor version bump.\n\n## License\n\nLicensed under either of\n\n * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n * [MIT license](http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n[//]: # (badges)\n\n[crate-image]: https://img.shields.io/crates/v/rsa\n[crate-link]: https://crates.io/crates/rsa\n[doc-image]: https://docs.rs/rsa/badge.svg\n[doc-link]: https://docs.rs/rsa\n[build-image]: https://github.com/RustCrypto/RSA/actions/workflows/ci.yml/badge.svg?branch=master\n[build-link]: https://github.com/RustCrypto/RSA/actions/workflows/ci.yml?query=branch:master\n[msrv-image]: https://img.shields.io/badge/rustc-1.83+-blue.svg\n[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg\n[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260047-RSA\n[deps-image]: https://deps.rs/repo/github/RustCrypto/RSA/status.svg\n[deps-link]: https://deps.rs/repo/github/RustCrypto/RSA\n\n[//]: # (links)\n\n[RustCrypto]: https://github.com/RustCrypto/\n[audit]: https://public.opentech.fund/documents/1907_OTF_DeltaChat_RPGP_RustRSA_GB_Report_v1.pdf\n[open security issues]: https://github.com/RustCrypto/RSA/issues?q=is%3Aissue+is%3Aopen+label%3Asecurity\n[modular exponentiation is not constant time]: https://github.com/RustCrypto/RSA/issues/19\n[random blinding]: https://en.wikipedia.org/wiki/Blinding_(cryptography)\n[Marvin Attack]: https://people.redhat.com/~hkario/marvin/\n[RUSTSEC-2023-0071]: https://rustsec.org/advisories/RUSTSEC-2023-0071.html\n[#390]: https://github.com/RustCrypto/RSA/issues/390\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRustCrypto%2FRSA","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRustCrypto%2FRSA","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRustCrypto%2FRSA/lists"}