Signer

Trait Signer 

Source
pub trait Signer:
    Send
    + Sync
    + 'static {
    // Required methods
    fn sig_type(&self) -> SignatureType;
    fn key_name(&self) -> &Name;
    fn sign<'a>(
        &'a self,
        region: &'a [u8],
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, TrustError>> + Send + 'a>>;

    // Provided methods
    fn cert_name(&self) -> Option<&Name> { ... }
    fn public_key(&self) -> Option<Bytes> { ... }
    fn sign_sync(&self, region: &[u8]) -> Result<Bytes, TrustError> { ... }
}
Expand description

Signs a region of bytes and produces a signature value.

Implemented as a dyn-compatible trait using BoxFuture so it can be stored as Arc<dyn Signer> in the key store.

Required Methods§

Source

fn sig_type(&self) -> SignatureType

Source

fn key_name(&self) -> &Name

Source

fn sign<'a>( &'a self, region: &'a [u8], ) -> Pin<Box<dyn Future<Output = Result<Bytes, TrustError>> + Send + 'a>>

Provided Methods§

Source

fn cert_name(&self) -> Option<&Name>

The certificate name to embed as a key locator in SignatureInfo, if any.

Source

fn public_key(&self) -> Option<Bytes>

Return the raw public key bytes, if available.

Source

fn sign_sync(&self, region: &[u8]) -> Result<Bytes, TrustError>

Synchronous signing — avoids Box::pin and async state machine overhead.

Signers whose work is pure CPU (Ed25519, HMAC) should override this.

Implementors§