• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H03-May-2022-8372

benches/H03-May-2022-5849

src/H03-May-2022-2,8771,982

tests/H03-May-2022-440340

.cargo-checksum.jsonH A D03-May-202289 11

.cargo_vcs_info.jsonH A D01-Jan-197074 65

.gitignoreH A D01-Jan-197030 43

Cargo.tomlH A D01-Jan-19702.9 KiB128104

Cargo.toml.orig-cargoH A D01-Jan-19702.2 KiB7060

LICENSE-APACHEH A D01-Jan-197010.6 KiB201169

LICENSE-MITH A D01-Jan-19701,022 2321

README.mdH A D01-Jan-19703.7 KiB10681

release.tomlH A D01-Jan-1970197 33

README.md

1# RSA
2
3[![crates.io][crate-image]][crate-link]
4[![Documentation][doc-image]][doc-link]
5[![Build Status][build-image]][build-link]
6![minimum rustc 1.51][msrv-image]
7[![Project Chat][chat-image]][chat-link]
8[![dependency status][deps-image]][deps-link]
9
10A portable RSA implementation in pure Rust.
11
12:warning: **WARNING:** This crate has been audited by a 3rd party, but a full blog post with the results and the updates made since the audit has not been officially released yet. See [#60](https://github.com/RustCrypto/RSA/issues/60) for more information.
13
14## Example
15
16```rust
17use rsa::{PublicKey, RsaPrivateKey, PaddingScheme};
18use rand::rngs::OsRng;
19
20let mut rng = OsRng;
21let bits = 2048;
22let priv_key = RsaPrivateKey::new(&mut rng, bits).expect("failed to generate a key");
23let pub_key = RsaPublicKey::from(&priv_key);
24
25// Encrypt
26let data = b"hello world";
27let enc_data = pub_key.encrypt(&mut rng, PaddingScheme::new_pkcs1v15(), &data[..]).expect("failed to encrypt");
28assert_ne!(&data[..], &enc_data[..]);
29
30// Decrypt
31let dec_data = priv_key.decrypt(PaddingScheme::new_pkcs1v15(), &enc_data).expect("failed to decrypt");
32assert_eq!(&data[..], &dec_data[..]);
33```
34
35> **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.
36> ```toml
37> [profile.debug]
38> opt-level = 3
39> ```
40> If you don't want to turn on optimizations for all dependencies,
41> you can only optimize the `num-bigint-dig` dependency. This should
42> give most of the speedups.
43> ```toml
44> [profile.dev.package.num-bigint-dig]
45> opt-level = 3
46> ```
47
48## Status
49
50Currently at Phase 1 (v) :construction:.
51
52There will be three phases before `1.0` :ship: can be released.
53
541. :construction:  Make it work
55    - [x] Prime generation :white_check_mark:
56    - [x] Key generation :white_check_mark:
57    - [x] PKCS1v1.5: Encryption & Decryption :white_check_mark:
58    - [x] PKCS1v1.5: Sign & Verify :white_check_mark:
59    - [ ] PKCS1v1.5 (session key): Encryption & Decryption
60    - [x] OAEP: Encryption & Decryption
61    - [x] PSS: Sign & Verify
62    - [x] Key import & export
632. :rocket: Make it fast
64    - [x] Benchmarks :white_check_mark:
65    - [ ] compare to other implementations :construction:
66    - [ ] optimize :construction:
673. :lock: Make it secure
68    - [ ] Fuzz testing
69    - [ ] Security Audits
70
71
72## Minimum Supported Rust Version (MSRV)
73
74All crates in this repository support Rust 1.51 or higher. In future
75minimally supported version of Rust can be changed, but it will be done with
76a minor version bump.
77
78## License
79
80Licensed under either of
81
82 * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
83 * [MIT license](http://opensource.org/licenses/MIT)
84
85at your option.
86
87### Contribution
88
89Unless you explicitly state otherwise, any contribution intentionally submitted
90for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
91dual licensed as above, without any additional terms or conditions.
92
93[//]: # (badges)
94
95[crate-image]: https://img.shields.io/crates/v/rsa.svg
96[crate-link]: https://crates.io/crates/rsa
97[doc-image]: https://docs.rs/rsa/badge.svg
98[doc-link]: https://docs.rs/rsa
99[build-image]: https://github.com/rustcrypto/RSA/workflows/CI/badge.svg
100[build-link]: https://github.com/RustCrypto/RSA/actions?query=workflow%3ACI+branch%3Amaster
101[msrv-image]: https://img.shields.io/badge/rustc-1.51+-blue.svg
102[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
103[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260047-RSA
104[deps-image]: https://deps.rs/repo/github/RustCrypto/RSA/status.svg
105[deps-link]: https://deps.rs/repo/github/RustCrypto/RSA
106