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§
Sourcefn signer_class(&self) -> &str
fn signer_class(&self) -> &str
Signer class sent as provenance.signer, e.g. "hmac" or "tpm".
Sourcefn sign(&self, payload: &[u8]) -> PhyTraceResult<String>
fn sign(&self, payload: &[u8]) -> PhyTraceResult<String>
Sign payload, returning the encoded signature.
Provided Methods§
Sourcefn boot_counter(&self) -> Option<u64>
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.
Sourcefn public_key_der(&self) -> Option<&[u8]>
fn public_key_der(&self) -> Option<&[u8]>
DER SubjectPublicKeyInfo of the signing key, for enrolling the
device with PhyCloud. None for shared-secret signers.
Sourcefn attestation_key_der(&self) -> Option<&[u8]>
fn attestation_key_der(&self) -> Option<&[u8]>
DER SubjectPublicKeyInfo of the attestation key (a restricted TPM
key), if the signer has one.
Sourcefn quote(&self, _nonce: &[u8], _pcrs: &str) -> Option<PhyTraceResult<Quote>>
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".