Trait wedpr_l_utils::traits::Signature[][src]

pub trait Signature {
    fn sign<T: ?Sized + AsRef<[u8]>>(
        &self,
        private_key: &T,
        msg_hash: &T
    ) -> Result<Vec<u8>, WedprError>;
fn verify<T: ?Sized + AsRef<[u8]>>(
        &self,
        public_key: &T,
        msg_hash: &T,
        signature: &T
    ) -> bool;
fn generate_keypair(&self) -> (Vec<u8>, Vec<u8>); }

Trait of a replaceable signature algorithm.

Required methods

fn sign<T: ?Sized + AsRef<[u8]>>(
    &self,
    private_key: &T,
    msg_hash: &T
) -> Result<Vec<u8>, WedprError>
[src]

Signs a message hash with the private key.

fn verify<T: ?Sized + AsRef<[u8]>>(
    &self,
    public_key: &T,
    msg_hash: &T,
    signature: &T
) -> bool
[src]

Verifies a message hash with the public key.

fn generate_keypair(&self) -> (Vec<u8>, Vec<u8>)[src]

Generates a new key pair for signature algorithm, where the first part is public key, the second part is private key.

Loading content...

Implementors

Loading content...