Skip to main content

Module event_crypto

Module event_crypto 

Source
Expand description

Cryptographic primitives for EventService transport.

The controller supplies a fresh random secret for every committed group epoch. Confidential event objects never use that secret directly as an AEAD key: they derive session-scoped sender/track keys, bind publisher/track/ session/membership-version/epoch/sequence into AAD, and use an injective counter nonce within each CSPRNG-generated session key domain. The module retains legacy low-level wrap helpers for compatibility, but the surviving EventService path distributes epochs exclusively through per-member HyKEM/COSE grants in group_key.

Key commitment provides fast wrong-key rejection before AES-256-GCM decryption. Publisher signature transcripts bind the plaintext and epoch coordinates and are consumed by the mandatory Ed25519 + ML-DSA-65 composite attestation in events.

Enums§

EventPrivacy
Privacy mode for event transport.

Functions§

build_epoch_event_sig_message
Hybrid-attested event transcript. Session, epoch coordinates, and sequence are signed, so possession of the symmetric epoch key is not publisher identity evidence.
build_epoch_object_aad
Canonical authenticated coordinates kept inside the application payload/AAD; a stock relay need not understand any of them.
build_event_sig_message
Build the signing message for EventEnvelopeV2.
build_topic_aad
Build length-prefixed AAD binding the keyed routing leaf + epoch (EV3).
build_wrap_aad
Build length-prefixed AAD for group key wrapping.
check_key_commitment
Check key commitment for fast rejection before AEAD.
decrypt_epoch_event
decrypt_event_full
Decrypt an event with full AAD binding (tag + ciphertext + prefix).
decrypt_event_keyed
Decrypt an event encrypted with encrypt_event_keyed (keyed-topic + epoch AAD). The caller must supply the same keyed_leaf + epoch used at encrypt time — a mismatch (cross-topic or cross-epoch replay) fails AEAD auth.
derive_event_nonce
Return the injective 96-bit nonce for one sequence in a session-scoped key domain. The session prefix is carried through the wire object and is also bound into the AEAD key; it avoids a fixed nonce label while preserving the only property AES-GCM needs: uniqueness for each (key, nonce) pair. Sequence zero is reserved as the pre-publication state.
derive_sender_track_key
Derive an AEAD key unique to one (epoch secret, sender, track, session) domain. The CSPRNG session prevents a restarted or concurrent publisher from reusing a key when its in-memory sequence restarts.
derive_wrap_key
Derive a wrap key from DH shared secret + pubkey XOR salt.
encrypt_epoch_event
encrypt_event
Encrypt an EventEnvelopeV2 payload with a group key.
encrypt_event_keyed
Encrypt an event with the keyed-topic + epoch bound into the AAD (EV3 confidential profile). Otherwise identical to encrypt_event.
key_commitment
Compute key commitment: keyed_mac(group_key, nonce)[0..16].
unwrap_group_key
Unwrap a group key blob.
wrap_group_key
Wrap a group key for a specific subscriber.