Skip to main content

RustCryptoRsaExt

Trait RustCryptoRsaExt 

Source
pub trait RustCryptoRsaExt {
    // Required methods
    fn rsa_private_key(&self) -> RsaPrivateKey;
    fn rsa_public_key(&self) -> RsaPublicKey;
}
Expand description

Extension trait to convert uselesskey RSA fixtures into RustCrypto rsa types.

§Examples

use uselesskey_core::Factory;
use uselesskey_rsa::{RsaFactoryExt, RsaSpec};
use uselesskey_rustcrypto::RustCryptoRsaExt;

let fx = Factory::random();
let keypair = fx.rsa("my-service", RsaSpec::rs256());

let private = keypair.rsa_private_key();
let public = keypair.rsa_public_key();

// Verify the key is usable
use rsa::signature::Signer;
let signing_key = rsa::pkcs1v15::SigningKey::<rsa::sha2::Sha256>::new_unprefixed(private);
let _sig = signing_key.sign(b"test");

Required Methods§

Source

fn rsa_private_key(&self) -> RsaPrivateKey

Convert the RSA fixture to an rsa::RsaPrivateKey.

Source

fn rsa_public_key(&self) -> RsaPublicKey

Derive the rsa::RsaPublicKey from the fixture’s private key.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl RustCryptoRsaExt for RsaKeyPair

Available on crate feature rsa only.

Implementors§