[][src]Trait crypto_api::signer::Signer

pub trait Signer: SecKeyGen + PubKeyGen {
    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>>; }

A stateless (oneshot) signature interface

Required methods

fn info(&self) -> SignerInfo

Returns information about the signer

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

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

Loading content...

Implementors

Loading content...