Trait rsa::SignatureScheme

source ·
pub trait SignatureScheme {
    // Required methods
    fn sign<Rng: CryptoRngCore, Priv: PrivateKey>(
        self,
        rng: Option<&mut Rng>,
        priv_key: &Priv,
        hashed: &[u8]
    ) -> Result<Vec<u8>>;
    fn verify<Pub: PublicKey>(
        self,
        pub_key: &Pub,
        hashed: &[u8],
        sig: &[u8]
    ) -> Result<()>;
}
Expand description

Digital signature scheme.

Required Methods§

source

fn sign<Rng: CryptoRngCore, Priv: PrivateKey>( self, rng: Option<&mut Rng>, priv_key: &Priv, hashed: &[u8] ) -> Result<Vec<u8>>

Sign the given digest.

source

fn verify<Pub: PublicKey>( self, pub_key: &Pub, hashed: &[u8], sig: &[u8] ) -> Result<()>

Verify a signed message.

hashed must be the result of hashing the input using the hashing function passed in through hash.

If the message is valid Ok(()) is returned, otherwise an Err indicating failure.

Implementors§