Function self_asserted_outer_pq_key
pub fn self_asserted_outer_pq_key(
cose_composite_bytes: &[u8],
) -> Result<Option<VerifyingKey<MlDsa65>>, Error>Expand description
The ML-DSA-65 verifying key the composite’s outer layer claims for
itself, read out of that layer’s kid protected header.
§This value is not trusted
It is attacker-controlled wire data: whoever produced the composite chose
it. It carries exactly one property — an outer signature that verifies
against it proves the producer held the matching ML-DSA-65 private key —
and it proves nothing about that key belonging to the identity in the
inner EdDSA layer. verify_composite therefore never reads it as an
anchor; it only compares it against a key the caller resolved from a trust
source, and rejects a mismatch.
The one legitimate use is as a candidate offered to a trust-on-first-use record — and verifying the composite against it is not sufficient grounds to record the pairing.
An earlier revision of this documentation claimed that a verifying composite
proves possession of both private keys. It does not, and the difference is
the whole attack: the nesting binds inner→outer only, so anyone holding a
copy of a valid inner layer can drop the outer, re-sign
payload ‖ inner_signature with an ML-DSA key of their own, and produce a
composite that verifies under the captured identity. What a plain verifying
composite proves is possession of the ML-DSA-65 key plus possession of one
replayable Ed25519 signature.
A recorded pairing therefore additionally requires
CompositeVerified::pq_bound — the inner layer’s signed commitment to the
key above it (see PQ_BINDING_HEADER_LABEL).
Returns Ok(None) when the composite has no outer layer (classical-only) or
when its outer layer carries no kid.