Trait min_jwt::sign::Signer

source ·
pub trait Signer {
    type Signature: Signature;
    type Error;

    // Required method
    fn sign(&self, bytes: &[u8]) -> Result<Self::Signature, Self::Error>;
}
Expand description

A type which can sign a byte buffer.

In some cases, the trait is directly implemented on a signing key type which can directly generate a signature.

In other cases, a new type composed of multiple fields may be needed because the signing key’s sign method may require more parameters (e.g. a random number generator).

Required Associated Types§

source

type Signature: Signature

Returned signature type which implmenets the Signature trait.

source

type Error

Returns an error.

Required Methods§

source

fn sign(&self, bytes: &[u8]) -> Result<Self::Signature, Self::Error>

Returns a signature from a byte buffer.

Errors

Returns an error dependent on the signer.

Implementations on Foreign Types§

source§

impl Signer for SigningKey<Sha256>

Available on crate feature rsa only.
§

type Signature = Signature

§

type Error = ()

source§

fn sign(&self, bytes: &[u8]) -> Result<Self::Signature, Self::Error>

source§

impl Signer for SigningKey

Available on crate feature p256 only.
§

type Signature = Signature

§

type Error = ()

source§

fn sign(&self, bytes: &[u8]) -> Result<Self::Signature, Self::Error>

source§

impl<T> Signer for &T
where T: Signer,

§

type Signature = <T as Signer>::Signature

§

type Error = <T as Signer>::Error

source§

fn sign(&self, bytes: &[u8]) -> Result<Self::Signature, Self::Error>

Implementors§

source§

impl<K, A> Signer for HmacKeySigner<K, A>
where K: HmacKey, A: Algorithm,

Available on crate feature ring only.
§

type Signature = <K as HmacKey>::Signature

§

type Error = <K as HmacKey>::Error

source§

impl<K, R, A> Signer for EcdsaKeyPairSigner<K, R, A>
where K: EcdsaKey, R: SecureRandom, A: Algorithm,

Available on crate feature ring only.
§

type Signature = <K as EcdsaKey>::Signature

§

type Error = <K as EcdsaKey>::Error

source§

impl<K, R, A> Signer for RsaKeyPairSigner<K, R, A>
where K: RsaKey, R: SecureRandom, A: Algorithm,

Available on crate feature ring only.
§

type Signature = <K as RsaKey>::Signature

§

type Error = <K as RsaKey>::Error