Trait jwts::jws::alg::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.

Object Safety§

This trait is not object safe.

Implementors§