https://github.com/mithril-security/rsa-sgx
Port RSA to Teaclave Rust SGX SDK and Xargo (add custom feature sgx_std for std error without pkcs1 fs access)
https://github.com/mithril-security/rsa-sgx
Last synced: 12 months ago
JSON representation
Port RSA to Teaclave Rust SGX SDK and Xargo (add custom feature sgx_std for std error without pkcs1 fs access)
- Host: GitHub
- URL: https://github.com/mithril-security/rsa-sgx
- Owner: mithril-security
- License: apache-2.0
- Created: 2021-11-16T16:27:44.000Z (over 4 years ago)
- Default Branch: bump-deps
- Last Pushed: 2021-11-16T17:17:17.000Z (over 4 years ago)
- Last Synced: 2025-04-01T14:49:55.304Z (about 1 year ago)
- Language: Rust
- Size: 272 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# RSA
[![crates.io][crate-image]][crate-link]
[![Documentation][doc-image]][doc-link]
[![Build Status][build-image]][build-link]
![minimum rustc 1.44][msrv-image]
[![Project Chat][chat-image]][chat-link]
[![dependency status][deps-image]][deps-link]
A portable RSA implementation in pure Rust.
: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.
## Example
```rust
use rsa::{PublicKey, RSAPrivateKey, PaddingScheme};
use rand::rngs::OsRng;
let mut rng = OsRng;
let bits = 2048;
let priv_key = RSAPrivateKey::new(&mut rng, bits).expect("failed to generate a key");
let pub_key = RSAPublicKey::from(&priv_key);
// Encrypt
let data = b"hello world";
let enc_data = pub_key.encrypt(&mut rng, PaddingScheme::new_pkcs1v15(), &data[..]).expect("failed to encrypt");
assert_ne!(&data[..], &enc_data[..]);
// Decrypt
let dec_data = priv_key.decrypt(PaddingScheme::new_pkcs1v15(), &enc_data).expect("failed to decrypt");
assert_eq!(&data[..], &dec_data[..]);
```
## Status
Currently at Phase 1 (v) :construction:.
There will be three phases before `1.0` :ship: can be released.
1. :construction: Make it work
- [x] Prime generation :white_check_mark:
- [x] Key generation :white_check_mark:
- [x] PKCS1v1.5: Encryption & Decryption :white_check_mark:
- [x] PKCS1v1.5: Sign & Verify :white_check_mark:
- [ ] PKCS1v1.5 (session key): Encryption & Decryption
- [x] OAEP: Encryption & Decryption
- [x] PSS: Sign & Verify
- [x] Key import & export
2. :rocket: Make it fast
- [x] Benchmarks :white_check_mark:
- [ ] compare to other implementations :construction:
- [ ] optimize :construction:
3. :lock: Make it secure
- [ ] Fuzz testing
- [ ] Security Audits
## Minimum Supported Rust Version (MSRV)
All crates in this repository support Rust 1.44 or higher. In future
minimally supported version of Rust can be changed, but it will be done with
a minor version bump.
## License
Licensed under either of
* [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
* [MIT license](http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.
[//]: # (badges)
[crate-image]: https://img.shields.io/crates/v/rsa.svg
[crate-link]: https://crates.io/crates/rsa
[doc-image]: https://docs.rs/rsa/badge.svg
[doc-link]: https://docs.rs/rsa
[build-image]: https://github.com/rustcrypto/RSA/workflows/CI/badge.svg
[build-link]: https://github.com/RustCrypto/RSA/actions?query=workflow%3ACI+branch%3Amaster
[msrv-image]: https://img.shields.io/badge/rustc-1.44+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260047-RSA
[deps-image]: https://deps.rs/repo/github/RustCrypto/RSA/status.svg
[deps-link]: https://deps.rs/repo/github/RustCrypto/RSA