Expand description
Cryptographic primitives for secure RPC communication.
This module provides:
- Ed25519 digital signatures for request envelope authentication
- Diffie-Hellman key exchange (Ristretto255 or ECDH P-256 in FIPS mode)
- Chained MACs for streaming response authentication
- Backend abstraction for KDF and MAC operations
§Chained MAC
Streaming responses use chained MACs where each chunk’s MAC depends on the previous chunk’s MAC. This provides cryptographic ordering without explicit sequence numbers:
mac_0 = MAC(key, request_id_bytes || data_0)
mac_n = MAC(key, mac_{n-1} || data_n)§Feature Flags
- Default: Blake3 for KDF and MAC (~10+ GB/s with SIMD)
fips: HKDF-SHA256 + HMAC-SHA256 (NIST SP 800-56C, FIPS 198-1)
Key exchange:
- Default: Ristretto255 (prime-order group, no cofactor issues)
fips: ECDH P-256 for FIPS 140-2 compliance
Re-exports§
pub use key_exchange::derive_notification_keys;pub use key_exchange::derive_stream_keys;pub use key_exchange::DefaultKeyExchange;pub use key_exchange::KeyExchange;pub use key_exchange::NotificationKeys;pub use key_exchange::StreamKeys;pub use signing::generate_signing_keypair;pub use signing::signing_key_from_bytes;pub use signing::verifying_key_from_bytes;pub use key_exchange::blinded_dh;pub use key_exchange::blinded_dh_raw;pub use key_exchange::generate_ephemeral_keypair;pub use key_exchange::reconstruct_blinded_pub_raw;pub use key_exchange::rerandomize_pubkey;pub use key_exchange::ristretto_dh;pub use key_exchange::ristretto_dh_raw;pub use key_exchange::RistrettoKeyExchange;pub use key_exchange::RistrettoPublic;pub use key_exchange::RistrettoSecret;
Modules§
- backend
- Cryptographic backend abstraction for KDF and MAC operations.
- broadcast_
primitives - Broadcast crypto primitives preserved from the removed NotificationService.
- cose_
encrypt - Canonical COSE_Encrypt0 sealing over Hyprstream’s pinned hybrid-KEM suite.
- cose_
sign - Nested-COSE hybrid composite signing for the hyprstream
SignedEnvelope(EdDSA + ML-DSA-65). - cose_
sign1 - COSE_Sign1 (RFC 9052) detached-payload signing for the hyprstream
SignedEnvelope. - event_
crypto - Cryptographic primitives for EventService transport.
- group_
key - Controller-managed hybrid group epochs for record-backed fan-out.
- hmac
- Stream block HMAC for authenticating streaming responses.
- hybrid_
kem - Hybrid multi-KEM key agreement (“HyKEM”) — #551 / S0 of epic #550.
- key_
exchange - Diffie-Hellman key exchange for stream MAC key derivation.
- pq
- Post-quantum hybrid cryptographic primitives (ML-DSA-65 + ML-KEM-768).
- signing
- Ed25519 digital signatures for request envelope authentication.
Structs§
- Signing
Key - ed25519 signing key which can be used to produce signatures.
- Stream
Hmac State - Chained HMAC state for stream block authentication, matching wire format.
- Verifying
Key - An ed25519 public key.
Enums§
- Crypto
Policy - Policy-selected envelope/token signature suite.
Functions§
- derive_
key - Derive a 32-byte key from input material with domain separation.
- keyed_
mac - Compute a 32-byte keyed MAC.
- keyed_
mac_ truncated - Compute a 16-byte truncated keyed MAC (for wire format).
- keyed_
mac_ truncated_ parts - Multi-part variant of
keyed_mac_truncated— authenticates the concatenation ofpartswithout allocating a joined buffer.