Trait Signer

Source
pub trait Signer: SecKeyGen + PubKeyGen {
    // Required methods
    fn info(&self) -> SignerInfo;
    fn sign(
        &self,
        buf: &mut [u8],
        data: &[u8],
        sec_key: &[u8],
    ) -> Result<usize, Box<dyn Error + 'static>>;
    fn verify(
        &self,
        data: &[u8],
        sig: &[u8],
        pub_key: &[u8],
    ) -> Result<(), Box<dyn Error + 'static>>;
}
Expand description

A stateless (oneshot) signature interface

Required Methods§

Source

fn info(&self) -> SignerInfo

Returns information about the signer

Source

fn sign( &self, buf: &mut [u8], data: &[u8], sec_key: &[u8], ) -> Result<usize, Box<dyn Error + 'static>>

Signs data into buf using sec_key and returns the signature length

Source

fn verify( &self, data: &[u8], sig: &[u8], pub_key: &[u8], ) -> Result<(), Box<dyn Error + 'static>>

Verifies sig for data with pub_key and returns an error if the signature was invalid

Implementors§