Skip to main content

RustCryptoEcdsaExt

Trait RustCryptoEcdsaExt 

Source
pub trait RustCryptoEcdsaExt {
    // Required methods
    fn p256_signing_key(&self) -> SigningKey;
    fn p256_verifying_key(&self) -> VerifyingKey;
    fn p384_signing_key(&self) -> SigningKey;
    fn p384_verifying_key(&self) -> VerifyingKey;
}
Expand description

Extension trait to convert uselesskey ECDSA fixtures into RustCrypto p256/p384 types.

Call the method matching your curve. Calling a P-256 method on a P-384 key (or vice versa) will panic.

§Examples

use uselesskey_core::Factory;
use uselesskey_ecdsa::{EcdsaFactoryExt, EcdsaSpec};
use uselesskey_rustcrypto::RustCryptoEcdsaExt;
use p256::ecdsa::signature::{Signer, Verifier};

let fx = Factory::random();
let keypair = fx.ecdsa("my-service", EcdsaSpec::es256());

let signing_key = keypair.p256_signing_key();
let signature: p256::ecdsa::Signature = signing_key.sign(b"hello");

let verifying_key = keypair.p256_verifying_key();
verifying_key.verify(b"hello", &signature).unwrap();

Required Methods§

Source

fn p256_signing_key(&self) -> SigningKey

Get the P-256 signing key. Panics if the key is not P-256.

Source

fn p256_verifying_key(&self) -> VerifyingKey

Get the P-256 verifying key. Panics if the key is not P-256.

Source

fn p384_signing_key(&self) -> SigningKey

Get the P-384 signing key. Panics if the key is not P-384.

Source

fn p384_verifying_key(&self) -> VerifyingKey

Get the P-384 verifying key. Panics if the key is not P-384.

Implementations on Foreign Types§

Source§

impl RustCryptoEcdsaExt for EcdsaKeyPair

Available on crate feature ecdsa only.

Implementors§