Skip to main content
This is unreleased documentation for the main (development) branch of crypto-glue.

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<C> Signer<(Signature<C>, RecoveryId)> for SigningKey<C>

Available on crate feature algorithm only.
Source§

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

Source§

impl<C> Signer<Signature<C>> for SigningKey<C>

Sign message using a deterministic ephemeral scalar (k) computed using the algorithm described in RFC6979 § 3.2.

Source§

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

Source§

impl<C> Signer<Signature<C>> for SigningKey<C>

Available on crate feature der only.
Source§

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

Source§

impl<C> Signer<SignatureWithOid<C>> for SigningKey<C>

Source§

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

Implementors§

Source§

impl<D> Signer<Signature> for crypto_glue::rsa::pkcs1v15::SigningKey<D>
where D: Digest,