Skip to main content

Module crypto

Module crypto 

Source
Expand description

RFC 10073 composite signatures, suite 1 id-MLDSA65-Ed25519-SHA512 (specification §2, §3.2–3.5, ADR-0011).

M'       = Prefix ‖ Label ‖ len(ctx) u8 ‖ ctx ‖ SHA-512(M)
mldsaSig = ML-DSA-65.Sign(mldsaSK, M', ctx = Label)      (FIPS 204 pure, hedged)
edSig    = Ed25519.Sign(edSK, M')

A signature is valid only when both components verify (Ed25519 strictly). The ctx is this protocol’s domain separation and is always supplied by the verifier (Context).

Modules§

voice
Voice media encryption (ADR-0018): an end-to-end layer over WebRTC whose keys come only from post-quantum or hybrid primitives, authenticated by the members’ composite keys.

Structs§

SecretKey
A suite-1 composite private key: mldsaSeed (FIPS 204 ξ, 32 B) ‖ edSK (32 B).
Sha3Hasher
An incremental content_hash, for attachment files read in pieces (§8.5).

Enums§

Context
An RFC 10073 ctx value of this protocol (specification §3.5). The verifier always supplies the context of the object type it expects; it is never read from the input.
ContextStatus
Whether a context is part of v1 conformance.
SignError
Signing failed.
VerifyError
Verification failed. Callers map every variant to INVALID_SIGNATURE; the variants exist for tests and diagnostics only.

Constants§

LABEL
RFC 10073 Label for id-MLDSA65-Ed25519-SHA512 (ASCII, 30 bytes); the ML-DSA context.
PREFIX
RFC 10073 Prefix (ASCII, 32 bytes).
SECRET_KEY_LEN
Length of SecretKey: mldsaSeed (32) ‖ edSK (32).

Functions§

community_id
CommunityId = SHA3-256("zaun/community-id/v1" ‖ 0x00 ‖ genesis root key), over the 1 985-byte encoding including the suite byte. Always the genesis key (§4.6).
content_hash
SHA3-256(bytes): how signed objects are identified, deduplicated and chained (never by signature bytes, §3.2), for example a delegation_hash.
host_id
HostId = SHA3-256("zaun/host-id/v1" ‖ 0x00 ‖ host public key).
message_prime
M' = Prefix ‖ Label ‖ len(ctx) u8 ‖ ctx ‖ SHA-512(M), or None when ctx exceeds 255 bytes.
publisher_id
PublisherId = SHA3-256("zaun/publisher-id/v1" ‖ 0x00 ‖ publisher key) (§4.9).
sign
Signs message (the canonical bytes B) with context ctx, hedged: ML-DSA draws 32 fresh bytes from the OS CSPRNG (FIPS 204 Algorithm 2 with the context prefix built here).
sign_deterministic
Deterministic signing (FIPS 204 deterministic variant). Golden test vectors only; real signatures use sign.
verify
Verifies sig over message with context ctx against pk (§3.3 steps 1–5).
verify_raw
RFC 10073 id-MLDSA65-Ed25519-SHA512 verification over raw components (no suite byte): pk = mldsaPK ‖ edPK (1 984 B), sig = mldsaSig ‖ edSig (3 373 B), any ctx ≤ 255 B. Both components are always checked. Protocol code uses verify; this exists for the RFC test vectors, whose ctx is not a protocol context.