Expand description
Opt-in negotiated transport encryption (enc/1, docs/roadmap.md, step 14).
Uses published standards implemented by the reviewed ring crate (no custom
cryptography):
- Ephemeral X25519 key agreement (RFC 7748) carried in
Labstream-Features: enc/1=<64-hex-pubkey>with zero extra round-trips. - HKDF-SHA256 (RFC 5869) key derivation bound to both public keys and an
optional pre-shared key (
labstream.EncryptionKey) for mutual peer authentication. - Length-prefixed ChaCha20-Poly1305 AEAD framing (RFC 8439) with strict 64-bit monotonic nonces and frame-length AAD binding on every byte after the two plain test-pattern samples.
enc/1 is off by default. Users enable it by adding enc to
labstream.Features, setting labstream.RequireEncryption = 1, or calling
set_runtime_policy.
Structs§
- EncReader
- Authenticated ChaCha20-Poly1305 frame reader that decrypts ciphertext chunks into plaintext bytes.
- EncWriter
- Authenticated ChaCha20-Poly1305 frame writer wrapping any
Writestream. - Encryption
Policy - Process-wide encryption policy.
- Ephemeral
Key - Ephemeral X25519 keypair for one feed handshake.
Constants§
- MAX_
FRAME_ CIPHER - Maximum ciphertext bytes accepted in one frame (plaintext + Poly1305 tag).
- MAX_
FRAME_ PLAIN - Maximum plaintext bytes sealed into one ChaCha20-Poly1305 frame.
- TAG_LEN
- Poly1305 authentication tag width in bytes.
Functions§
- compiled_
in - True when this binary was compiled with the
encryptionCargo feature. - effective_
policy - Active encryption policy from
set_runtime_policyorlsl_api.cfg. - set_
runtime_ policy - Override the active encryption policy at runtime (pass
Noneto revert tolsl_api.cfgdefaults).