Skip to main content

Sign

Trait Sign 

Source
pub trait Sign:
    Send
    + Sync
    + Debug {
    // Required methods
    fn key_id(&self) -> SigningKeyId;
    fn sign(&self, payload: &[u8]) -> Result<Signature, SignError>;
}
Expand description

Whatever can produce a signature for a key it holds.

The seam the open key-management question lives behind. An in-process key, an agent socket, a cloud KMS, and a hardware token differ in where the private bytes are and how a signature is requested; none of that is visible to a checker, which asks for a signature and gets one or does not commit.

Required Methods§

Source

fn key_id(&self) -> SigningKeyId

Which key this signs with.

Recorded in every piece of evidence, so a verifier knows what to check against without being handed the key material.

Source

fn sign(&self, payload: &[u8]) -> Result<Signature, SignError>

Sign a pre-image.

§Errors

SignError::Unavailable if the key could not be used. There is no success value that means “unsigned”.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§