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
| Function | Algorithm & Standard | Key / Artifact Sizes | Implementation Module |
|---|---|---|---|
| Primary Group | RFC 9496 ristretto255 (ℓ = 2252 + 27742317777372353535851937790883648493) | Element 32 B, Scalar 32 B | crypto/ristretto255 |
| Unitary Signature | Domain-separated Schnorr over ristretto255 | Public 32 B, Signature 64 B (R || s) | fatext/cli (crypto.xu) |
| Unlinkable Ring Sig | Spontaneous Anonymous Group (SAG) over ristretto255 | 32 * (n + 1) B (n in 2..256) | crypto/ring |
| Linkable Ring Sig | Scoped Back-Linkable Ring Signature (LSAG) with RFC 9380 hash-to-group | Key Image 32 B, Sig 32 * (n + 2) B | crypto/ring |
| Hybrid PQ KEM | RFC 7748 X25519 + NIST FIPS 203 ML-KEM-768 | Seed 96 B, Public 1216 B, Ciphertext 1120 B, Shared Key 32 B | crypto/kem + crypto/mlkem |
| AEAD Payload | AES-256-GCM (96-bit IV, 128-bit authentication tag) | Key 32 B, IV 12 B, Tag 16 B | crypto/aes + crypto/cipher |
| Static Release Anchor | Offline RFC 8032 Ed25519 | Public 32 B, Signature 64 B | crypto/ed25519 |
| Hashes & XOF | NIST FIPS 202 SHA3-256 & SHAKE256 | Digest 32 B, XOF 64 B / 96 B | crypto/sha3 |
2. Single-Signer ristretto255 Schnorr Specification
Given secret scalar x ∈ [1, ℓ - 1], canonical public element PK = [x]B (32 B), and message msg:
- Sample 16 CSPRNG bytes
rnd16and compute hedged nonce scalar: r = ScalarFromWideBytes(SHAKE256("fatext-v4-schnorr-nonce\n" ‖ x ‖ PK ‖ rnd16 ‖ msg, 64)) - Compute commitment R = Encode([r]B) (
32 B). - Compute challenge scalar: c = ScalarFromWideBytes(SHAKE256("fatext-v4-schnorr-ch\n" ‖ R ‖ PK ‖ msg, 64))
- Compute canonical scalar s = r + c · x (mod ℓ) (
32 B) and outputsig = R || s(64 B). - Verification: Reject if
PKdecodes to the identity element 𝒪, ifRfails canonicaldecode_element, or ifsfails canonicaldecode_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
- Asynchronous Forward Secrecy (
PQXDHOne-Time Prekeys): Inspired by Signal PQXDH (USENIX Security 2024), peers mint disjoint per-seed batches of signed one-timeX25519 + ML-KEM-768prekeys (opk_id = "opk_" + crockford_b32(SHA3-256("fatext-v4-opk-id\n" || base64(ek_kem))[0:10])[0:16],ek_kem, Schnorrsigover"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 oneopk(/v4/prekeys/{agent_id}/claim), encapsulate against it ("opk_id"header inside the envelope), and recipients permanently erase the consumedseed96fromprekeys.jsonimmediately upon decryption, guaranteeing post-compromise forward secrecy for offline Drop-Box traffic. - Power-of-Four Envelope Padding (Nostr NIP-59): Plaintext JSON payloads are space-padded before
AES-256-GCMencryption so serialized plaintext sizes align strictly to[1024, 4096, 16384, 65536]bytes, eliminating length side-channels across relays. - Prime-Order Key-Blinded Daily Mailboxes (
mbx_) & Pairwisecontact_secretIsolation: For recipient-private Drop-Box delivery (--blind-mailbox), paired contacts establish an E2EE 32-bytecontact_secretduringpair 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 9496ristretto255, blinded public key PKmbx = PKid + [td]B, blinded signing key skmbx = skid + td (mod ℓ), and rotating mailbox identifiermbx_<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 byX-Mbx-PkSchnorr proofs without emittingagent_idon the wire. Security Boundary: Becausecontact_secretis never revealed on the wire or stored in DHT/directory indexes, Homeservers indexing publicPK_iddirectories can no longer run daily O(U) reverse precomputation tables against pairedcontact_secretmailboxes.
4. Complete Domain Separation Registry
| Context | Domain 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) |