Skip to main content

Signer

Trait Signer 

Source
pub trait Signer<S> {
    // Required method
    fn try_sign(&self, msg: &[u8]) -> Result<S, Error>;

    // Provided method
    fn sign(&self, msg: &[u8]) -> S { ... }
}
Expand description

Sign the provided message bytestring using Self (e.g. a cryptographic key or connection to an HSM), returning a digital signature.

Required Methods§

Source

fn try_sign(&self, msg: &[u8]) -> Result<S, Error>

Attempt to sign the given message, returning a digital signature on success, or an error if something went wrong.

The main intended use case for signing errors is when communicating with external signers, e.g. cloud KMS, HSMs, or other hardware tokens.

§Errors

Returns implementation-specific errors in the event signing failed (e.g. KMS or HSM communication error).

Provided Methods§

Source

fn sign(&self, msg: &[u8]) -> S

Sign the given message and return a digital signature.

Implementors§

Source§

impl<P: MlDsaParams> Signer<Signature<P>> for ExpandedSigningKey<P>

The Signer implementation for ExpandedSigningKey uses the optional deterministic variant of ML-DSA, and only supports signing with an empty context string. If you would like to include a context string, use the ExpandedSigningKey::sign_deterministic method.

Source§

impl<P: MlDsaParams> Signer<Signature<P>> for SigningKey<P>

The Signer implementation for SigningKey uses the optional deterministic variant of ML-DSA, and only supports signing with an empty context string.