Trait Algorithm

Source
pub trait Algorithm {
    type SignKey: ?Sized;
    type VerifyKey: ?Sized;

    // Required methods
    fn name() -> &'static str;
    fn sign(
        data: impl AsRef<[u8]>,
        key: &Self::SignKey,
    ) -> Result<Vec<u8>, Error>;
    fn verify(
        data: impl AsRef<[u8]>,
        sig: impl AsRef<[u8]>,
        key: &Self::VerifyKey,
    ) -> Result<(), Error>;
}

Required Associated Types§

Required Methods§

Source

fn name() -> &'static str

Name of the algorithm

Source

fn sign(data: impl AsRef<[u8]>, key: &Self::SignKey) -> Result<Vec<u8>, Error>

Calculate the signature of the data with the key.

Source

fn verify( data: impl AsRef<[u8]>, sig: impl AsRef<[u8]>, key: &Self::VerifyKey, ) -> Result<(), Error>

Verify the signature with the key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§