openssl-magic-public-key

Crates.ioopenssl-magic-public-key
lib.rsopenssl-magic-public-key
version0.1.0
sourcesrc
created_at2019-01-27 19:59:08.627508
updated_at2019-01-27 19:59:08.627508
descriptionExtension traits for the OpenSSL Rsa type to convert between magic-public-key and Rsa
homepage
repositoryhttps://git.asonix.dog/asonix/openssl-magic-public-key
max_upload_size
id110984
size6,556
asonix (asonix)

documentation

README

OpenSSL Magic Public key

In the event you need to produce or consume a magic public key, this library helps in the conversion between a magic-public-key-formatted String, and an openssl::rsa::Rsa<T> type.

Usage

This crate exposes two traits:

pub trait AsMagicPublicKey {
    fn as_magic_public_key(&self) -> String;
}

pub trait FromMagicPublicKey: Sized {
    fn from_magic_public_key(magic_public_key: &str) -> Result<Self, KeyError>;
}

Add OpenSSL Magic Public Key to your dependencies.

openssl = "0.10"
openssl-magic-public-key = "0.1"

Add it to your code

AsMagicPublicKey is implemented for Rsa<T> where T: HasPublic. This means from any instantiated Rsa, you can produce a magic-public-key-formatted String.

let rsa = Rsa::generate(2048)?;

let magic_public_key: String = rsa.as_magic_public_key();

FromMagicPublicKey is implemented for Rsa<Public>.

let rsa = Rsa::from_magic_public_key(&magic_public_key)?;

License

Copyright © 2019 Riley Trautman

OpenSSL Magic Public Key is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

OpenSSL Magic Public Key is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This file is part of OpenSSL Magic Public Key.

You should have received a copy of the GNU General Public License along with OpenSSL Magic Public Key. If not, see http://www.gnu.org/licenses/.

Commit count: 0

cargo fmt