pkcs1 and pkcs8 reading and writing for rsa
Go to file
2021-03-28 14:41:49 -05:00
examples Make it work with Real PEM PKCS8 Keys 2020-04-21 17:30:57 -05:00
src Fix tests 2020-07-25 09:31:04 -05:00
.gitignore Initial commit 2019-09-30 21:42:37 -05:00
Cargo.toml Update to latest RSA 2021-03-28 14:41:49 -05:00
LICENSE Initial commit 2019-09-30 21:42:37 -05:00
README.md Make it work with Real PEM PKCS8 Keys 2020-04-21 17:30:57 -05:00

RSA PEM

Converting between the PEM format and a RustCrypto RSA type

This library will be useless after the next release of the RSA crate, which should have this functionality baked in.

use rsa_pem::KeyExt as _;
use rsa::{RSAPrivateKey};

let mut rng = rand::thread_rng();
let rsa = RSAPrivateKey::new(&mut rng, 2048)?;

let pem: String = rsa.to_pem_pkcs8()?;

let res = RSAPrivateKey::from_pem_pkcs8(&pem)?;

assert!(res.is_ok());

Contributing

Unless otherwise stated, all contributions to this project will be licensed under the CSL with the exceptions listed in the License section of this file.

License

This work is licensed under the Cooperative Software License. This is not a Free Software License, but may be considered a "source-available License." For most hobbyists, self-employed developers, worker-owned companies, and cooperatives, this software can be used in most projects so long as this software is distributed under the terms of the CSL. For more information, see the provided LICENSE file. If none exists, the license can be found online here. If you are a free software project and wish to use this software under the terms of the GNU Affero General Public License, please contact me at asonix@asonix.dog and we can sort that out. If you wish to use this project under any other license, especially in proprietary software, the answer is likely no.