Expand description
COSE_Sign1 (RFC 9052) detached-payload signing for the hyprstream
SignedEnvelope.
Stage C of Phase 0.5 migrates envelope authentication from a bespoke
Ed25519.sign(serialize(envelope)) scheme to standards-based
COSE_Sign1 with a detached payload and a domain-separating
external_aad.
§Wire shape
Each SignedEnvelope.signatures entry is the CBOR encoding of a
COSE_Sign1 structure (see RFC 9052 §4.2). The signed payload is the
Cap’n Proto-canonical bytes of the RequestEnvelope, detached — it
is not embedded in the COSE structure itself. The signer’s identity
and algorithm are conveyed via the protected header (kid, alg).
§external_aad
To prevent schema-confusion (signing one schema’s bytes and replaying
them as another schema), external_aad is computed as the CBOR
encoding of [envelope_schema_id, inner_type_id] — two Cap’n Proto
file/type IDs as u64s. Sender and receiver must agree on these
IDs; the verifier passes them in, and a mismatch causes verification
to fail with InvalidSignature.
Structs§
- Parsed
Cose Sign1 - Parsed COSE_Sign1 with kid + alg extracted from the protected header.
Traits§
- Cose
Signer - Trait abstracting over a signing key.
- Cose
Verifier - Trait abstracting over a verifying key.
Functions§
- build_
external_ aad - Build the COSE
external_aadfor envelope signing. - parse
- Parse a CBOR-encoded COSE_Sign1 blob. Does not verify the signature.
- peek_
kid_ alg - Inspect a COSE_Sign1 without verifying it, returning
(kid_bytes, alg_int). - sign_
detached - Sign
payload(detached) withsigning_key, producing CBOR-encodedCOSE_Sign1bytes. - sign_
ed25519_ detached - Concrete Ed25519 detached-signature wrapper for envelope.rs.
- verify_
detached - Verify a CBOR-encoded
COSE_Sign1against the detachedpayloadandexternal_aad. - verify_
ed25519_ detached - Concrete Ed25519 verification wrapper. Reconstructs
external_aadfrom the given schema/inner IDs and verifies the parsed COSE_Sign1’s detached signature againstpubkey+payload.