Skip to main content

Signer

Trait Signer 

Source
pub trait Signer: Send + Sync {
    // Required methods
    fn signer_class(&self) -> &str;
    fn algorithm(&self) -> &str;
    fn key_id(&self) -> Option<&str>;
    fn sign(&self, payload: &[u8]) -> PhyTraceResult<String>;
    fn verify(&self, payload: &[u8], signature: &str) -> PhyTraceResult<bool>;

    // Provided methods
    fn boot_counter(&self) -> Option<u64> { ... }
    fn public_key_der(&self) -> Option<&[u8]> { ... }
    fn attestation_key_der(&self) -> Option<&[u8]> { ... }
    fn quote(&self, _nonce: &[u8], _pcrs: &str) -> Option<PhyTraceResult<Quote>> { ... }
}
Expand description

Produces and checks provenance signatures over signing-payload bytes.

Required Methods§

Source

fn signer_class(&self) -> &str

Signer class sent as provenance.signer, e.g. "hmac" or "tpm".

Source

fn algorithm(&self) -> &str

Algorithm sent as provenance.algorithm.

Source

fn key_id(&self) -> Option<&str>

Key identifier sent as provenance.key_id.

Source

fn sign(&self, payload: &[u8]) -> PhyTraceResult<String>

Sign payload, returning the encoded signature.

Source

fn verify(&self, payload: &[u8], signature: &str) -> PhyTraceResult<bool>

Check signature over payload.

Provided Methods§

Source

fn boot_counter(&self) -> Option<u64>

Hardware-anchored count of agent starts, sent as provenance.boot_counter. A TPM signer reads it from a TPM NV counter that it increments once per start; it never decreases, so receivers can order events by (boot_counter, sequence_num) even if the sequence state file is rolled back. None for signers without one.

Source

fn public_key_der(&self) -> Option<&[u8]>

DER SubjectPublicKeyInfo of the signing key, for enrolling the device with PhyCloud. None for shared-secret signers.

Source

fn attestation_key_der(&self) -> Option<&[u8]>

DER SubjectPublicKeyInfo of the attestation key (a restricted TPM key), if the signer has one.

Source

fn quote(&self, _nonce: &[u8], _pcrs: &str) -> Option<PhyTraceResult<Quote>>

TPM2 quote over pcrs (e.g. DEFAULT_PCRS) bound to nonce, signed by the attestation key. None if the signer cannot quote.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§