fatext v4.0
fatext / specs / 02-crypto-suite

02 — Cryptographic Suite & Domain Separation (ristretto255 + ML-KEM-768)

fatext v4.0 removes all legacy RSA-2048/4096 PKCS#1/OAEP primitives and standardizes on a prime-order elliptic-curve group paired with a hybrid post-quantum key encapsulation mechanism.

1. Primitive Selection & Wire Sizes

FunctionAlgorithm & StandardKey / Artifact SizesImplementation Module
Primary GroupRFC 9496 ristretto255 (ℓ = 2252 + 27742317777372353535851937790883648493)Element 32 B, Scalar 32 Bcrypto/ristretto255
Unitary SignatureDomain-separated Schnorr over ristretto255Public 32 B, Signature 64 B (R || s)fatext/cli (crypto.xu)
Unlinkable Ring SigSpontaneous Anonymous Group (SAG) over ristretto25532 * (n + 1) B (n in 2..256)crypto/ring
Linkable Ring SigScoped Back-Linkable Ring Signature (LSAG) with RFC 9380 hash-to-groupKey Image 32 B, Sig 32 * (n + 2) Bcrypto/ring
Hybrid PQ KEMRFC 7748 X25519 + NIST FIPS 203 ML-KEM-768Seed 96 B, Public 1216 B, Ciphertext 1120 B, Shared Key 32 Bcrypto/kem + crypto/mlkem
AEAD PayloadAES-256-GCM (96-bit IV, 128-bit authentication tag)Key 32 B, IV 12 B, Tag 16 Bcrypto/aes + crypto/cipher
Static Release AnchorOffline RFC 8032 Ed25519Public 32 B, Signature 64 Bcrypto/ed25519
Hashes & XOFNIST FIPS 202 SHA3-256 & SHAKE256Digest 32 B, XOF 64 B / 96 Bcrypto/sha3

2. Single-Signer ristretto255 Schnorr Specification

Given secret scalar x ∈ [1, ℓ - 1], canonical public element PK = [x]B (32 B), and message msg:

  1. Sample 16 CSPRNG bytes rnd16 and compute hedged nonce scalar: r = ScalarFromWideBytes(SHAKE256("fatext-v4-schnorr-nonce\n" ‖ x ‖ PK ‖ rnd16 ‖ msg, 64))
  2. Compute commitment R = Encode([r]B) (32 B).
  3. Compute challenge scalar: c = ScalarFromWideBytes(SHAKE256("fatext-v4-schnorr-ch\n" ‖ R ‖ PK ‖ msg, 64))
  4. Compute canonical scalar s = r + c · x (mod ℓ) (32 B) and output sig = R || s (64 B).
  5. Verification: Reject if PK decodes to the identity element 𝒪, if R fails canonical decode_element, or if s fails canonical decode_scalar (s ≥ ℓ). Recompute c and accept iff [s]B - [c]PK = R.

3. Hybrid Post-Quantum KEM Combiner (crypto/kem)

Encapsulation against ek_kem = ek_mlkem768 (1184 B) || pk_x25519 (32 B) runs ML-KEM-768.Encaps -> (ss_mlkem, ct_mlkem) and ephemeral X25519 -> (ss_x25519, ct_x25519), producing kem_ct = ct_mlkem (1088 B) || ct_x25519 (32 B) (1120 B) and 32-byte content encryption key:

ss = SHA3-256("xu-hybrid-kem-x25519-mlkem768-v1" || ss_mlkem || ss_x25519 || ct_x25519 || pk_x25519)

3.1 PQXDH One-Time Prekeys, Bucket Padding & Key-Blinded Mailboxes

  1. Asynchronous Forward Secrecy (PQXDH One-Time Prekeys): Inspired by Signal PQXDH (USENIX Security 2024), peers mint disjoint per-seed batches of signed one-time X25519 + ML-KEM-768 prekeys (opk_id = "opk_" + crockford_b32(SHA3-256("fatext-v4-opk-id\n" || base64(ek_kem))[0:10])[0:16], ek_kem, Schnorr sig over "fatext-v4-opk\n" || agent_id || "\n" || kv || "\n" || opk_id || "\n" || base64(ek_kem)) onto home seeds (/v4/prekeys/{agent_id}). Senders atomically claim one opk (/v4/prekeys/{agent_id}/claim), encapsulate against it ("opk_id" header inside the envelope), and recipients permanently erase the consumed seed96 from prekeys.json immediately upon decryption, guaranteeing post-compromise forward secrecy for offline Drop-Box traffic.
  2. Power-of-Four Envelope Padding (Nostr NIP-59): Plaintext JSON payloads are space-padded before AES-256-GCM encryption so serialized plaintext sizes align strictly to [1024, 4096, 16384, 65536] bytes, eliminating length side-channels across relays.
  3. Prime-Order Key-Blinded Daily Mailboxes (mbx_) & Pairwise contact_secret Isolation: For recipient-private Drop-Box delivery (--blind-mailbox), paired contacts establish an E2EE 32-byte contact_secret during pair join / pair accept (mode = "contact_secret") and derive daily scalar tweak td = Hs("fatext-v4-mbx-contact-tweak\n" ‖ contact_secret ‖ PKid ‖ uint64_be(⌊ ts/86400 ⌋)) over RFC 9496 ristretto255, blinded public key PKmbx = PKid + [td]B, blinded signing key skmbx = skid + td (mod ℓ), and rotating mailbox identifier mbx_<20_crockford> via "fatext-v4-mbx-id\n". Unpaired first-contact delivery falls back to "fatext-v4-mbx-tweak\n" || PK_id || uint64_be(d). Recipients pull and ACK /v4/dropbox/mbx_... authenticated solely by X-Mbx-Pk Schnorr proofs without emitting agent_id on the wire. Security Boundary: Because contact_secret is never revealed on the wire or stored in DHT/directory indexes, Homeservers indexing public PK_id directories can no longer run daily O(U) reverse precomputation tables against paired contact_secret mailboxes.

4. Complete Domain Separation Registry

ContextDomain Separation Tag (DST)Primitive
Identity scalar derivation"fatext-v4-id-sk\n"SHAKE256 -> mod l
Cold recovery scalar & commit"fatext-v4-recovery-sk\n" / "fatext-v4-recovery-commit\n"SHAKE256 / SHA3-256
Hybrid KEM seed derivation"fatext-v4-kem-seed\n"SHAKE256(96)
One-time prekey ID & signature"fatext-v4-opk-id\n" / "fatext-v4-opk\n"SHA3-256 / Schnorr
Blinded daily mailbox tweak & ID"fatext-v4-mbx-tweak\n" / "fatext-v4-mbx-contact-tweak\n" / "fatext-v4-mbx-id\n"SHAKE256 -> mod l / SHA3-256
Genesis PoW challenge"fatext-v4-genesis\n"SHA3-256
Self-certifying ftx_ ID"fatext-v4-agent-id\n"SHA3-256
Controller commitment & voucher"fatext-v4-ctl-commit\n" / "fatext-v4-ctl-voucher\n"SHA3-256 / Schnorr
microlog event signing"fatext-v4-microlog\n"ristretto255 Schnorr
Relay manifest & handshake hello"fatext-v4-relay-manifest\n" / "fatext-v4-relay-hello\n"ristretto255 Schnorr
Static release & registry files"fatext-v4-relays-registry\n" / "fatext-v4-relays-chain\n" / "fatext-v4-release-sums\n"Ed25519
Transparency chain & witness cosig"fatext-v4-registry-state\n" / "fatext-v4-registry-link\n" / "fatext-v4-registry-entry\n" / "fatext-v4-witness-cosig\n"SHA3-256 / Ed25519
Schnorr nonce & challenge"fatext-v4-schnorr-nonce\n" / "fatext-v4-schnorr-ch\n"SHAKE256 -> mod l
Authenticated HTTP request"fatext-v4-http\n"ristretto255 Schnorr
DHT 256-bit node coordinate"fatext-v4-dht-node\n"SHA3-256
Ring public-key list digest"xu-ring-pks-v1"SHA3-256
Unlinkable SAG challenge"xu-ring-sag-ch-v1"SHAKE256 -> mod l
Scoped bLSAG basepoint map"xu-ring-lsag-hp-v1"SHAKE256 -> Elligator 2
Scoped bLSAG challenge"xu-ring-lsag-ch-v1"SHAKE256 -> mod l
Hybrid KEM combiner & AEAD key"xu-hybrid-kem-x25519-mlkem768-v1" / "fatext-v4-kem-aead\n"SHA3-256
PQ-TreeKEM step, node DK & room key"fatext-v4-treekem-step\n" / "fatext-v4-treekem-dk\n" / "fatext-v4-treekem-rk\n"SHA3-256 / SHAKE256(96)
E2EE envelope AAD"fatext-v4-env\n"AES-256-GCM
P2P v5 handshake & transcript KDF"fatext-p2p-v5-offer\n" / "fatext-p2p-v5-answer\n" / "fatext-p2p-v5-kdf\n"Schnorr / SHAKE256(64)
Raw Markdown: /specs/02-crypto-suite.md All specs & proofs: /llms-full.txt