pub enum AttestationVerdict {
Valid,
ValidIdentityOnly,
CommitmentMismatch {
expected: String,
signed: String,
},
BadSignature,
UnknownAlgorithm(String),
MalformedKey,
MalformedSignature,
MalformedCommitment,
}Expand description
The outcome of checking a ProvenanceAttestation (SPEC.md §6.5.4).
Every failure is named. A boolean would collapse “this signature is forged” into “I was handed a truncated key,” and those call for opposite responses: the first is an incident, the second is a configuration bug.
Variants§
Valid
The signature verifies against the recomputed commitment, and that commitment binds the frame’s content.
ValidIdentityOnly
The signature verifies, but over a preimage that does not bind the
frame’s content: the frame declared no content_digest, so
frame_commitment hashed the absence of one (SPEC.md §6.5.2).
What this does and does not prove is the whole reason the variant exists. It proves the named provider issued a frame with this id and this provenance chain. It does not prove the bytes served under that id are the bytes that were signed — the provider can serve one document today and a different one tomorrow, and this same signature keeps verifying, because the content was never in the preimage.
Before this variant existed, that case returned Valid
and a verifier had no way to tell the two apart (#128). A host that
rendered such a frame as “signed” was making a claim the signature did
not support.
is_valid is false here, so the default answer is
the safe one. A host that has its own reason to accept an identity-only
attestation must say so by matching this variant or calling
signature_verifies — which is the point:
the decision becomes visible in the code that makes it.
A conformant attester does not produce this. SPEC.md §6.5.2 requires a
provider that signs a frame to populate content_digest; encountering
this verdict means the frame was signed by a non-conformant attester, or
predates that requirement.
CommitmentMismatch
The signature is well-formed and verifies, but over a different commitment than this frame produces — the frame or its provenance was altered after signing. The loudest possible finding.
Fields
BadSignature
The commitment matches but the signature does not verify under the supplied key: a forgery, or the wrong key.
UnknownAlgorithm(String)
The named algorithm is not one this build can check. Not a failure to validate — a refusal to guess.
MalformedKey
The public key was not a well-formed key for the named algorithm.
MalformedSignature
The signature field was not well-formed for the named algorithm.
MalformedCommitment
signed_commitment was not a well-formed sha256:<hex> digest.
Implementations§
Source§impl AttestationVerdict
impl AttestationVerdict
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Whether this verdict is Valid — the signature checks
out and it binds the frame’s content.
A host MUST NOT treat any other verdict as provisionally acceptable: the point of an attestation is that “I could not check it” and “it is good” are never the same answer.
That includes ValidIdentityOnly, which is
deliberately not valid here. Its signature does verify, but over a
preimage that says nothing about the bytes in hand, and a host asking
“is this good?” is asking about the bytes. Use
signature_verifies to ask the narrower
question on purpose.
Sourcepub fn signature_verifies(&self) -> bool
pub fn signature_verifies(&self) -> bool
Whether the signature itself checked out, whatever it covers.
True for Valid and
ValidIdentityOnly. This is the question to
ask when the caller genuinely wants provider identity and provenance
without a claim about content — an audit trail of who answered, say,
rather than a check that an answer is unaltered.
It is a separate method rather than a looser is_valid because the
difference between them is the whole of #128: one accepts a frame whose
content can be swapped without disturbing the signature, and the other
does not. Whichever a caller wants, it should be legible at the call
site which one they asked for.
Sourcepub fn binds_content(&self) -> bool
pub fn binds_content(&self) -> bool
Whether the verified commitment binds the frame’s content bytes.
Only Valid does. A verdict that did not verify at all
binds nothing, so this is false for every failure too.
Trait Implementations§
Source§impl Clone for AttestationVerdict
impl Clone for AttestationVerdict
Source§fn clone(&self) -> AttestationVerdict
fn clone(&self) -> AttestationVerdict
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more