Skip to main content

Module cose_encrypt

Module cose_encrypt 

Source
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§

InboundReplayLedger
Bounded state for authenticated inbound replay rejection.
OutboundNonceLedger
Irreversible bounded state for outbound nonce use.
SealContext
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.