Expand description
Canonical COSE_Encrypt0 sealing over Hyprstream’s pinned hybrid-KEM suite.
This module implements the reusable confidentiality substrate for #553. The
outer object and its authenticated-data construction are COSE_Encrypt0 from
RFC 9052, and the content algorithm is the registered ChaCha20/Poly1305 COSE
algorithm (24). Key establishment is Hyprstream’s suite-identified N-KEM
combiner in crate::crypto::hybrid_kem.
This is deliberately not called HPKE or COSE-HPKE. Hyprstream’s N-KEM
combiner is not an HPKE ciphersuite, and its composite encapsulation material
is not the enc / ek value defined by draft-ietf-cose-hpke. The private
labels below define a project-local profile and make no draft-interoperability
claim. PQUIP / RFC 9794 supplies transition terminology, not wire semantics.
New consumers should use seal and seal_prederived with an owning
OutboundNonceLedger, and open and open_prederived with an owning
InboundReplayLedger. The fresh-encapsulation envelope wrappers at the
bottom remain only for the already-landed signed envelope path, whose replay
lifecycle is owned by SignedEnvelope.
Structs§
- Inbound
Replay Ledger - Bounded state for authenticated inbound replay rejection.
- Outbound
Nonce Ledger - Irreversible bounded state for outbound nonce use.
- Seal
Context - Authenticated identity and nonce coordinates for one sealed object.
Constants§
- MAX_
COSE_ BYTES - Maximum canonical COSE object accepted before parsing or KEM work.
- MAX_
EXTERNAL_ AAD_ BYTES - Maximum caller-supplied external AAD / transcript bytes (64 KiB).
- MAX_
IDENTIFIER_ BYTES - Maximum recipient or key identifier length.
- MAX_
LEDGER_ ENTRIES - Maximum number of nonce/replay entries retained by one ledger.
- MAX_
PLAINTEXT_ BYTES - Maximum plaintext accepted by this substrate (16 MiB).
Functions§
- derive_
aead_ key - Derive a separated base content key from a hybrid combiner secret.
- open
- Open from a hybrid recipient and record replay state after authentication.
- open_
from_ recipient - Compatibility wrapper for the existing encrypted-envelope lifecycle.
- open_
prederived - Open with a pre-derived base key and explicit replay state.
- seal
- Seal to a hybrid recipient with bounded canonical COSE and nonce-use state.
- seal_
prederived - Seal with a pre-derived base key and explicit lifecycle-owned nonce state.
- seal_
to_ recipient - Compatibility wrapper for the existing encrypted-envelope lifecycle.