Status Draft. Protocol version 1 (sv1) of the Sloppy Voice v2 product
Date 2026-12-04
Depends on 00 (overview, §7 conventions), 03 (transport, error object and registry)
Decisions used D-006, D-007, D-008, D-021, D-025, D-027, D-028, D-030, D-032, D-033, D-034, D-038, D-039, D-040, D-041, D-043, D-052, D-053, D-054, D-055, D-060, D-065
Owns Crypto suite sv1-c1 (sv1-c2 reserved); JWS profile and typ registry; Ed25519 verification rules; JWK and thumbprint conventions; labelled-signature construction and label registry; HKDF/HMAC label registry; MLS exporter label registry; AEAD and nonce rules; attachment encryption (SVF1) and padding buckets; CPace profile; Argon2id profile; randomness and key-handling rules; test-vector format; crypto.* error codes

Conformance. This document applies to every conformance class of 00 §1.5. Every Server, SFU-capable server, Full client, Web client, Bot client and Push gateway that creates or verifies a JWS MUST follow §4 to §6. Every implementation that handles secure-mode keys (secure clients, secure bots) MUST also follow §7 to §14. A server MUST follow §8 to §10 where it checks structure (for example the SVF1 size rule or Argon2id parameters) even though it never holds content keys. The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in BCP 14 (RFC 2119, RFC 8174) when, and only when, they appear in all capitals, as shown here. Rationale notes start with "Rationale:" and are informative. Examples are informative unless marked otherwise; test vectors in §16 are normative.

1. Scope

1.1 What this document covers

This document fixes the cryptography that every other Sloppy Voice document builds on:

  • the single crypto suite sv1-c1 and the rule that nothing inside it is negotiated (§2);
  • how cryptographic values are encoded (§3);
  • Ed25519 key generation, signing and strict verification, applied everywhere (§4);
  • public keys as JWKs and their RFC 7638 thumbprints (ikf, dkf) (§5);
  • the JWS profile, the typ registry and how a verifier picks the key (§6);
  • labelled signatures and their label registry (§7);
  • HKDF, HMAC and hash domain separation, the label registry and the MLS exporter label registry (§8);
  • AES-256-GCM rules: nonces, usage bounds, associated data, key commitment, and the HPKE profile (§9);
  • the segmented attachment encryption format SVF1 and the padding buckets (§10);
  • the CPace profile used for pairing (§11) and the Argon2id profile used for the KeyBackup (§12);
  • randomness and key handling (§13, §14);
  • the crypto.* error codes (§15);
  • test-vector format, location and vectors (§16);
  • crypto agility and the post-quantum path (§17).

1.2 What this document doesn't cover

  • Claims of protocol objects. The owner of each object defines its claims and their meaning: HomeAssertion, DeviceProof and S2S tokens (06); IdentityCertificate, DeviceCertificate, IdentityState and DeviceRevocation (07); KeyRotation (02); RelayTicket (15); push gateway request tokens (19). This document defines only the profile every JWS follows.
  • The MLS profile (13) and the SFrame profile (18). This document pins only the ciphersuite numbers and owns the exporter label registry.
  • The inputs of owner derivations. For example 14 defines exactly what goes into K_msg, and 08 defines the KeyBackup and vault record layouts. This document owns the label strings and the rules those inputs must follow.
  • The pairing protocol (sessions, endpoints, events, message bodies, payload) (08). This document defines every byte of the CPace run inside it: the inputs, the generator, the shares, the transcript, ISK and the confirmation tags (§11). Document 08 carries those values in its message bodies and MUST NOT define them differently.
  • Platform key-storage details (08). This document states the principles in §14.

1.3 Notation

Notation Meaning
a || b Byte concatenation.
"text" The ASCII (or, where stated, UTF-8) bytes of the string, with no terminator and no length prefix.
0x00 One byte with that value.
X[i..j] Bytes i up to but not including j of X, counting from 0. X[0..16] is the first 16 bytes. "Truncated to n bytes" means X[0..n].
u8(n), u16(n), u32(n), u64(n) n as an unsigned big-endian integer of 1, 2, 4 or 8 bytes.
len(X) Length of X in bytes.
HKDF-Expand(PRK, info, L) RFC 5869 §2.3 with SHA-256.
HKDF-Extract(salt, IKM) RFC 5869 §2.2 with SHA-256.
HMAC(K, m) HMAC-SHA256 (RFC 2104).
SHA-256(m), SHA-512(m) FIPS 180-4.
AEAD-Encrypt(K, N, A, P) AES-256-GCM encryption (§9), returning ciphertext || 16-byte tag.
MLS-Exporter(label, context, L) RFC 9420 §8.5, in the group's current epoch.
TLS presentation language The binary encoding of RFC 8446 §3 as extended by RFC 9420 §2.1, including variable-length vectors opaque x<V> with the QUIC-style variable-length integer length prefix (RFC 9420 §2.1.2).
lv_cat(a, b, …) The CPace length-value concatenation of the pinned draft (§11.1): each argument preceded by its length as an LEB128 integer. Used only inside CPace.
now The verifier's current time as a NumericDate (integer seconds since the epoch, UTC).

2. The crypto suite sv1-c1

2.1 Primitives

Protocol version 1 has exactly one crypto suite, sv1-c1 (D-027). Every sv1 implementation MUST implement all of it.

Use Primitive Parameters in sv1-c1
Signatures by server keys, identity keys and device signing keys (DSKs) Ed25519 (RFC 8032 §5.1, "pure" Ed25519, not Ed25519ph or Ed25519ctx) Strict verification (§4.3)
Diffie-Hellman X25519 (RFC 7748) Only inside MLS ciphersuite 0x0001, CPace, and HPKE to a device's box key (08)
Public-key encryption of one key to one device HPKE (RFC 9180) base mode, single-shot: KEM 0x0020 DHKEM(X25519, HKDF-SHA256), KDF 0x0001 HKDF-SHA256, AEAD 0x0002 AES-256-GCM Only to a device's box key: VaultKeyGrants (08) and HistoryShare key wraps (14) (§9.8)
Hash SHA-256 Thumbprints, hash domain separators, attachment hashes
Hash SHA-512 Inside Ed25519, CPace, safety numbers (07)
Key derivation HKDF-SHA256 (RFC 5869) §8
MAC HMAC-SHA256 (RFC 2104) §8
Application AEAD AES-256-GCM (NIST SP 800-38D) 96-bit nonce, 128-bit tag (§9)
Attachments AES-256-GCM in 64 KiB segments, SVF1 format §10
Group key agreement MLS (RFC 9420), ciphersuite 0x0001 MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 The only MLS ciphersuite in v1 (13)
Media encryption SFrame (RFC 9605) cipher suite 0x0004 AES_128_GCM_SHA256_128 MLS key schedule of RFC 9605 §5.2 (18)
Password-authenticated key exchange CPace, CPACE-X25519-SHA512 §11
Password hashing Argon2id (RFC 9106), version 0x13 m = 65,536 KiB, t = 3, p = 1, 16-byte salt, 32-byte output (§12)
Web Push RFC 8030 with RFC 8291 encryption and VAPID (RFC 8292) Subscription keys managed by the browser (19); the home server signs the VAPID JWT with ES256 (P-256) under its webPushKey (02, 19 §12.2). That JWT is outside the §6 profile.
Transport TLS 1.2 or later (1.3 RECOMMENDED); DTLS 1.2 or later for WebRTC Not account keys (§2.4)
Safety numbers Iterated SHA-512, 5,200 rounds, two 30-digit halves Defined in 07
Randomness A cryptographically secure random number generator (CSPRNG) §13

Proposed decision: HPKE (RFC 9180) base mode with DHKEM(X25519, HKDF-SHA256), HKDF-SHA256 and AES-256-GCM is part of sv1-c1, used only to encrypt one key to one device's X25519 box key: VaultKeyGrants (08 §10) and the key wraps of HistoryShares (14 §7.5, D-007 as revised). This adopts 08's proposal. Rationale: every client already carries HPKE inside its MLS library, and it is the standard way to encrypt one key to one device's public key.

2.2 No negotiation

  1. There is no algorithm negotiation inside sv1-c1 (D-027). No message, header or metadata field lets a peer choose a different signature algorithm, hash, AEAD, KDF or parameter set.
  2. A verifier MUST reject any object that names an algorithm, cipher suite, format version or parameter set other than the one this document fixes for that object, with crypto.unsupported_algorithm (§15). It MUST NOT fall back to another algorithm or retry with weaker parameters.
  3. In v1 the suite is implied by the protocol version (sv1). Objects don't carry a suite identifier. Where an object needs a format version for future change, it carries one that is specific to that object: the JWS typ (§6.3), the SVF1 magic (§10.4), the Argon2idParams alg and v (§12.2), the CPaceAD version (§11.3), the MLS ciphersuite inside MLS objects (13), and the SFrame cipher suite (18).

Rationale: negotiation is where downgrade attacks live. One suite means one code path for every implementer and nothing for an attacker to steer.

2.3 Reserved suite sv1-c2

The identifier sv1-c2 is reserved for a future post-quantum hybrid suite (§17). Suite identifiers match this ABNF:

suite-id    = "sv" 1*DIGIT "-c" 1*DIGIT     ; e.g. "sv1-c1"

A v1 implementation MUST treat every suite identifier other than sv1-c1 as unsupported.

2.4 Insecure accounts and transport keys (D-060)

D-021 says insecure accounts hold no cryptographic keys. This document interprets it as follows (D-060), and every document MUST apply the same interpretation.

  1. Account keys are the identity key, device signing keys, box keys (08), vault keys, the recovery-phrase entropy, history keys, message keys, file keys, and MLS state (leaf HPKE keys, init keys, epoch secrets). A client of an insecure account MUST NOT generate, store or register any account key. A device registration for an insecure account carries no public key.
  2. Ephemeral transport keys are not account keys. Every client, including clients of insecure accounts, uses:
    • TLS keys for HTTPS and WebSocket connections;
    • WebRTC DTLS keys and certificates for relay and SFU connections, generated fresh for each call join, or at least for each context. A client SHOULD NOT reuse a DTLS certificate (including a browser RTCCertificate) across contexts or servers, because its fingerprint would then be a stable identifier of the device;
    • Web Push subscription keys (the P-256 key pair and auth secret of RFC 8291), which the browser creates and manages;
    • the OAuth PKCE code_verifier (RFC 7636), which is a one-time secret, not a key.
  3. A transport key MUST NOT be bound to the account in any protocol object, MUST NOT be registered with a server as an account key, and MUST NOT be used for application-layer or end-to-end signing or encryption of content. It protects only the hop it was negotiated for.
  4. Holding no keys doesn't mean doing no cryptography. A client of an insecure account still verifies signatures, for example on an IdentityState it fetched to compute DM security (12). Verification uses only public keys.
  5. Bearer secrets (session tokens, bot tokens) aren't cryptographic keys in this sense. They are covered by 05 and 03.

3. Encoding of cryptographic values

3.1 base64url

Binary values in JSON use base64url without padding (RFC 4648 §5), as 00 §7.2 requires. For every cryptographic field (keys, signatures, hashes, thumbprints, nonces, ciphertexts, MLS objects, salts, jti, did), decoders MUST additionally:

  1. reject any character outside A–Z, a–z, 0–9, -, _, including =, +, /, white space and line breaks;
  2. reject a string whose length modulo 4 is 1;
  3. reject a non-canonical encoding, in which the unused low bits of the last character aren't zero: when the length modulo 4 is 2, the last character MUST be one of A Q g w; when it is 3, the last character MUST be one of A E I M Q U Y c g k o s w 0 4 8;
  4. reject a decoded value whose length doesn't match the length the field requires (§3.4).

A failure is crypto.malformed with reason: "encoding" or "length".

b64url-char    = ALPHA / DIGIT / "-" / "_"
b64url         = *b64url-char             ; plus the canonical-tail rule above

Rationale: a non-canonical encoding gives one byte string two spellings. A thumbprint or pin computed over the spelling instead of the bytes could then disagree for the same key. Rejecting non-canonical input removes the problem at the parser.

3.2 Binary structures

Every binary structure this specification signs, MACs, hashes, uses as AEAD associated data or HPKE info, or feeds into a KDF, other than a JWS signing input, MUST be injective: two different field lists MUST never produce the same bytes. Its owner defines a byte layout in which every field is one of:

  • fixed-length (integers are big-endian and fixed-size: u8, u16, u32, u64; a 16-byte mid, a 32-byte key);
  • length-prefixed with a stated width: u8, u16 or u32 lengths, or the RFC 9420 variable-length integer of the TLS presentation language (§1.3);
  • terminated by a byte that can't occur in the field (for example 0x0A after a canonical address, which can't contain a line feed).

Strings are UTF-8 (canonical addresses are already NFC, see 01). The TLS presentation language as used by RFC 9420 is RECOMMENDED for new structures, because implementations already carry its codec for MLS. Constructions fixed by external specifications keep their own encoding: CPace uses the pinned draft's lv_cat (§11), and MLS and HPKE use theirs. 08's lv(x) is the RFC 9420 variable-length vector encoding (opaque x<V>), the RECOMMENDED form; owners that use a fixed-width prefix such as u16(len(x)) || x (for example 14's V16) also conform.

JSON MUST NOT be used as signed, MACed, hashed or associated-data input, except as the exact transmitted bytes of a JWS signing input. A JSON object MUST NOT be re-serialized to produce bytes for verification.

Rationale: the property that matters is that the encoding can't be ambiguous; one mandated format would make several already-reviewed layouts non-conforming for no security gain. Re-serialized JSON is never byte-stable across libraries.

3.3 Hexadecimal

Hexadecimal appears only in test vectors and diagnostics: lowercase, two digits per byte, no separators, no 0x prefix.

3.4 Lengths

Value Bytes base64url characters
Ed25519 public key 32 43
Ed25519 private key (the RFC 8032 seed) 32 43
Ed25519 signature 64 86
X25519 public key (including a box key and an HPKE enc) 32 43
SHA-256 output, thumbprint (ikf, dkf) 32 43
AES-256 key, HKDF output used as a key 32 43
AES-GCM nonce 12 16
AES-GCM tag (appended to the ciphertext) 16 —
SealedMessage key commitment kc (14) 16 22
Epoch key ID ekid (14) 8 11
Device ID did 16 22
jti 16 to 64 22 to 86
Argon2id salt 16 22

An Ed25519 private key that has to travel (inside the pairing payload or the KeyBackup, 08) is always the 32-byte seed of RFC 8032 §5.1.5, never the 64-byte expanded form. X25519 private keys never travel.

4. Ed25519

These rules apply to every Ed25519 operation in Sloppy Voice: JWS (§6), labelled signatures (§7), and MLS signatures made with SignWithLabel (RFC 9420 §5.1.2), including leaf signatures and GroupInfo signatures.

4.1 Key generation

  1. A private key is 32 bytes from the CSPRNG (§13). The public key is derived as in RFC 8032 §5.1.5.
  2. Each key has exactly one purpose (§14.1). A key MUST NOT be reused across purposes, for example a DSK as an identity key or a server sign key as an MLS external-sender key.
  3. An implementation SHOULD check, once at generation, that the public key isn't in the small-order list of §4.4. (Honest generation can't produce one; the check catches broken random number generators and fault injection.)

4.2 Signing

  1. Signatures are pure Ed25519 (RFC 8032 §5.1.6), deterministic, with no context string.
  2. A signer of a long-lived object (IdentityCertificate, DeviceCertificate, DeviceRevocation, KeyRotation) SHOULD verify its own signature with §4.3 before publishing it.

Rationale: self-verification catches fault attacks and memory corruption on the one key that is hardest to replace.

4.3 Strict verification

A verifier MUST reject a signature unless all of these hold:

  1. The public key A is exactly 32 bytes and its encoding is canonical: the encoded y (the low 255 bits, little-endian) is less than p = 2^255 − 19, and the encoding isn't one that RFC 8032 §5.1.3 decoding rejects (including x = 0 with the sign bit set).
  2. A has order exactly L: it isn't one of the eight points of order 1, 2, 4 or 8 (equivalently [8]A isn't the neutral element; §4.4 lists their canonical encodings), and [L]A is the neutral element, so A has no small-order component (it isn't of "mixed order"). A verifier MAY rely on this check having been made when the key was accepted (§4.5), and MAY cache its result per key.
  3. The signature is exactly 64 bytes, R || S.
  4. R is canonically encoded (as in item 1) and decodes to a point.
  5. R isn't of small order (§4.4).
  6. S, read as a little-endian integer, is less than the group order L = 2^252 + 27742317777372353535851937790883648493.
  7. The cofactorless equation holds: [S]B = R + [k]A, where k = SHA-512(R || A || M) reduced mod L and M is the exact message bytes.

A failure of item 1 or 2 is crypto.invalid_key (the key is unusable whatever it signed). A failure of items 3 to 7 is crypto.bad_signature.

Additional rules:

  • Verifiers MUST NOT use batch verification in v1.
  • Verifiers MUST use the cofactorless equation of item 7. A library that uses the cofactored equation [8][S]B = [8]R + [8][k]A (including every library that implements the permissive ZIP-215 rules) MAY be used only if the verifier applies items 1, 2, 4, 5 and 6 around it and also checks that [L]R is the neutral element. With A and R both in the prime-order subgroup and S < L, the two equations accept exactly the same signatures. Without the [L]R check they don't: a signer can add a small-order component to R so that cofactored verifiers accept and cofactorless verifiers reject (vector V-4g).
  • Web clients. A web client MUST NOT rely on crypto.subtle.verify alone, because browsers don't specify which equation or which key checks their Ed25519 implementation uses. It MUST apply items 1, 2, 4, 5 and 6 itself (item 2 needs Ed25519 point arithmetic, which WebCrypto doesn't expose), and it MAY use crypto.subtle.verify for items 3 and 7 only after a self-test at start-up has shown that the browser accepts V-4a and rejects V-4g. Otherwise it MUST verify with a bundled implementation that uses the cofactorless equation (for example a WebAssembly build of libsodium).
  • An MLS stack (13) MUST either apply these rules to MLS signatures, or rely on checks done when the key was accepted: a leaf signature_key equals a DSK whose DeviceCertificate was validated with items 1 and 2, so the stack itself then only needs items 3 to 7.
  • The vectors of §16 (V-4) are the arbiter. An implementation that disagrees with any of them isn't conforming, whatever its library documents.

Rationale: Ed25519 libraries disagree on edge cases. A signature that one server accepts and another rejects would let an attacker split the federation's view of who signed what. These are the strictest common rules, and they make acceptance a pure function of the bytes. Rejecting mixed-order keys costs one scalar multiplication per key, once, at the points of §4.5; honest key generation never produces such keys.

4.4 Small-order points

The eight small-order points have these canonical encodings (hexadecimal, as transmitted). For the small-order part of §4.3 items 2 and 5, an implementation MAY compare against this list instead of computing [8]A, but then MUST also reject every non-canonical encoding (§4.3 item 1), because non-canonical encodings of the same points exist.

Encoding Order
0100000000000000000000000000000000000000000000000000000000000000 1 (neutral element)
ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f 2
0000000000000000000000000000000000000000000000000000000000000000 4
0000000000000000000000000000000000000000000000000000000000000080 4
c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a 8
c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa 8
26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05 8
26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85 8

(Each entry was checked by computing the point's order.)

4.5 Where keys are checked

A key MUST pass §4.3 items 1 and 2 (canonical encoding, not small order, and in the prime-order subgroup) at every point where it is accepted, so that later signature checks can rely on it:

Key Checked when
Server signing key Fetched from ServerMetadata or accepted through keyChain (02)
MLS external-sender key Read from ServerMetadata or a group's external_senders extension (13)
Identity key An IdentityCertificate is registered (PUT /v1/me/identity, 07), received in an IdentityState, pinned, or received in a pairing payload or KeyBackup (08)
DSK A DeviceCertificate is registered or validated (07)

A server MUST refuse to register an identity key or DSK that fails these checks, with crypto.invalid_key.

4.6 Implementation notes (informative)

  • Web clients. WebCrypto's Ed25519 implementations differ between browsers in how strictly they check keys and R, and in which equation they use; §4.3 says what a web client does about it. Item 5 is a comparison against the §4.4 list once canonical encoding (item 4) has been checked, and item 6 is a 32-byte integer comparison.
  • libsodium. crypto_sign_verify_detached rejects non-canonical and small-order public keys, small-order R and non-canonical S, and compares a recomputed R encoding with the transmitted one under the cofactorless equation. It doesn't reject mixed-order public keys; crypto_core_ed25519_is_valid_point does, and is a convenient way to make the §4.3 item 2 check when a key is accepted. Implementers confirm the combination with V-4.
  • OpenSSL. While the V-4 vectors were being computed, OpenSSL 3.5 (through Python cryptography 50) accepted V-4c, V-4d, V-4f, V-4i and V-4j, all of which §4.3 rejects. It needs the explicit checks of items 1, 2, 4 and 5 around it.
  • Other libraries. Several popular libraries accept small-order or mixed-order keys, or implement ZIP-215. Wrap them as §4.3 describes.

5. Public keys in JSON: JWKs and thumbprints

5.1 JWK form

Every Ed25519 public key in JSON or in a JWS payload is a JWK (RFC 7517, RFC 8037) with these key members:

Member Type Required Value
kty string Yes "OKP"
crv string Yes "Ed25519"
x string Yes base64url of the 32-byte public key (§3.1, canonical)

Rules:

  1. A JWK that represents an identity key or a DSK (ik, dsk, 07) MUST contain exactly kty, crv and x. A verifier MUST reject one with any other member, with crypto.invalid_key.
  2. Other owners MAY define additional non-key metadata members for their JWKs: 02 defines kid and purpose for the KeyRotation key claim, and kid, purpose, status, nbf, exp, retiredAt, rvt and the optional alg for ServerMetadata keys entries (02 §11.1). Verifiers apply the owner's member list. Additional members never enter a thumbprint (§5.2).
  3. A JWK MUST NOT contain d or any other private-key member, in any context. A verifier rejects one with crypto.invalid_key.
  4. Inside MLS and other binary structures, public keys are the raw 32 bytes.
  5. An X25519 public key appears as a JWK in exactly one place: the dbk claim of a DeviceCertificate, an OKP JWK with exactly kty = "OKP", crv = "X25519" and x (07 §4.1); the Ed25519 checks of §4.3 don't apply to it. Everywhere else in JSON (an 08 BoxKey's pub, an HPKE enc) an X25519 key is the base64url of the raw 32 bytes. Where a raw key is compared with dbk, it is compared with the 32 bytes of the JWK's x member.

5.2 Thumbprints (ikf, dkf)

The key ID of an identity key (ikf) or a DSK (dkf) is its RFC 7638 JWK thumbprint with SHA-256:

thumbprint(A) = base64url( SHA-256( "{\"crv\":\"Ed25519\",\"kty\":\"OKP\",\"x\":\"" || base64url(A) || "\"}" ) )

That is, SHA-256 over the UTF-8 bytes of the JSON object with the required members crv, kty, x in that (lexicographic) order, no white space, and x the canonical base64url of the 32 raw key bytes. The result is 43 base64url characters (32 bytes).

  1. An implementation MUST compute the thumbprint from the decoded 32-byte key re-encoded canonically, never from a received x string.
  2. Thumbprints are compared as exact strings or as the 32 decoded bytes; both are equivalent because the encoding is canonical.
  3. Where a binary structure needs a key fingerprint (for example an sv_participants entry, 13), it uses the 32-byte SHA-256 output of item 1, not a different hash.
  4. Thumbprints aren't shown to people in ordinary user interfaces. Out-of-band verification uses safety numbers (07). A client MAY show thumbprints on an advanced diagnostics screen.

Vector V-2 in §16 gives a worked thumbprint.

6. JWS profile

Every Sloppy Voice signed object outside MLS and SFrame, other than the VAPID JWT of RFC 8292 (19), is a JWS (RFC 7515) in compact serialization (D-027, 00 §7.13). This section is the single profile for all of them.

6.1 Serialization

  1. Only the compact serialization is used. The JSON serializations, detached payloads, unencoded payloads (RFC 7797), unsecured JWS (alg: none) and JWE are never used.
  2. A JWS is three base64url parts separated by .:
sv-jws        = b64-header "." b64-payload "." b64-signature
b64-header    = 1*b64url-char
b64-payload   = 1*b64url-char
b64-signature = 86b64url-char                 ; exactly 64 bytes
  1. The JWS signing input is the ASCII bytes of b64-header "." b64-payload, exactly as transmitted.
  2. A JWS is stored, relayed and embedded (for example idc inside an IdentityState) as the exact compact string. It is never decoded and re-encoded (00 §7.2).

6.2 Protected header

The protected header is an I-JSON object with exactly three members:

Member Type Required Value
alg string Yes "EdDSA" (RFC 8037), always with an Ed25519 key
typ string Yes A value from the registry in §6.3, compared byte-for-byte, case-sensitive
kid string Yes The signing key's ID, in the form §6.4 requires for the typ's signer class
  1. A verifier MUST reject a header with any other member, with crypto.header_rejected. This explicitly includes jwk, jku, x5u, x5c, x5t, x5t#S256, crit, b64, zip, cty, enc and nonce, and also every member not listed here.
  2. A verifier MUST reject a header that is missing typ or kid (crypto.header_rejected), has an alg other than "EdDSA" (crypto.unsupported_algorithm), or has a typ other than the one the verifying context expects (crypto.wrong_type).
  3. Producers SHOULD serialize the header with the members in the order alg, typ, kid and no white space, so that test vectors are reproducible. Verifiers MUST accept any member order.
  4. The decoded header MUST NOT exceed 1,024 bytes.

Rationale: allowing only three header members closes the classic JOSE attacks in one rule: algorithm confusion, keys embedded in the header, remote key URLs, and critical extensions that some libraries silently ignore.

6.3 typ registry

This document owns the registry. Each owner document defines the claims of its type.

typ-value  = "sv-" typ-name "+jwt"
typ-name   = lc-alnum *23( lc-alnum / "-" )
lc-alnum   = %x61-7A / DIGIT
typ Object Signer class (§6.4) Issuer claim matched to kid exp Maximum lifetime (exp − iat) Maximum size Owner
sv-assert+jwt HomeAssertion Server (home server) iss Required 300 s 4,096 bytes 06
sv-devproof+jwt DeviceProof Device (DSK) — Required 60 s 1,024 bytes 06
sv-s2s+jwt S2S request token Server (sending server) iss Required 60 s 4,096 bytes 06
sv-relay+jwt RelayTicket Server (hosting server) iss Required 60 s 8,192 bytes 15
sv-push+jwt Push gateway request token Server (home server) iss Required 60 s 4,096 bytes 19
sv-idstate+jwt IdentityState Server (home server) iss Required 86,400 s (24 h) 32,768 bytes 07
sv-idcert+jwt IdentityCertificate Identity — Forbidden Until reset 2,048 bytes 07
sv-devcert+jwt DeviceCertificate Identity — Forbidden Until revoked or reset 2,048 bytes 07
sv-devrevoke+jwt DeviceRevocation Identity — Forbidden Permanent 1,024 bytes 07
sv-keyrot+jwt KeyRotation Server (a sign key: the previous active sign key for a new sign key, the current active sign key otherwise; 02 §12.1) iss Forbidden Permanent 2,048 bytes 02
sv-test+jwt Test vectors only Any — Optional 300 s 8,192 bytes 04
  1. "Maximum size" is the length of the whole compact string. A verifier MUST check it before base64url-decoding anything, and reject a larger JWS with crypto.malformed (reason: "size").
  2. An owner MAY set a shorter maximum lifetime than the registry, never a longer one.
  3. The "Maximum size" column records each owner's limit, so that the registry is the one table implementers use. An owner MAY lower its limit; the registry is then corrected to the owner's value, and until then verifiers apply the smaller of the two. No type may exceed 65,536 bytes.
  4. sv-test+jwt exists only for test vectors. No production verifier expects it, so §6.2 item 2 rejects it everywhere. Its claims are iss, sub, iat, jti, an optional exp and an optional aud (a single string, §6.5); it doesn't define nbf (§6.6).
  5. A new type is added only by a revision of this document. Its name MUST match typ-value.

Rationale for the IdentityState limit: an IdentityState embeds an IdentityCertificate and lists every active and revoked device, each revocation possibly carrying a DeviceRevocation JWS. 07 bounds the lists so that the worst case fits in 32 KiB.

6.4 kid and key selection

Each typ has a signer class. The class fixes the kid form and how the verifier obtains the key. A verifier MUST NOT use kid to search a global key store, and MUST NOT accept a key from any JWS header member.

kid-value        = server-kid / key-thumbprint
server-kid       = canonical-domain "#" key-id
canonical-domain = <a canonical domain: lowercase A-labels, see 01>
key-id           = 1*32( ALPHA / DIGIT / "." / "_" / "-" )
key-thumbprint   = 43b64url-char               ; §5.2
Signer class kid Key source Checks
Server server-kid The keys of the ServerMetadata (02) of the domain in kid, obtained through discovery and subject to 02's pinning and keyChain rules. A relay verifying a RelayTicket MAY instead use the key set its hosting server configured for it (21). The domain part MUST equal the value of the type's issuer claim (§6.3), which MUST be a canonical domain (D-032). The key MUST have purpose: "sign" and a status that 02 allows for verification. If no key matches, the verifier refetches the metadata (at most once per minute per domain, 02) and tries again. Then the failure codes of 02 §11.6, or the type owner's codes.
Identity key-thumbprint = ikf The identity key the verifying context expects: for an IdentityCertificate, the ik claim inside it (§6.10); for a DeviceCertificate or DeviceRevocation, the ik of the IdentityCertificate it is validated against (07). kid MUST equal the thumbprint of that key; otherwise crypto.unknown_key.
Device key-thumbprint = dkf The dsk of the DeviceCertificate the verifying context expects (06, 07). kid MUST equal the thumbprint of that key; otherwise crypto.unknown_key.

Rationale: kid is a cross-check, not a pointer. Every verifier already knows, from context, whose key it should be: the issuer's server, the account's identity key, or the session's device. A kid that points anywhere else is an attack or a bug.

6.5 Payload

  1. The payload is an I-JSON object (RFC 7493), UTF-8, at most 8 levels of nesting.
  2. A verifier MUST reject a payload with duplicate member names, invalid UTF-8 or lone surrogates (crypto.malformed, reason: "json"). A generic JSON parser that keeps the last duplicate silently isn't conforming here.
  3. Unknown claims are ignored, as everywhere in sv1 (00 §7.2). Owners define which claims are required.
  4. If an owner defines aud, it is a single string: a canonical domain, or a URL where the owner says so (the relay URL for sv-relay+jwt, 15; the gateway URL for sv-push+jwt, 19). A verifier MUST reject an array-valued aud (crypto.invalid_claims).
  5. Addresses and domains in claims are canonical (D-032). The check, and its error address.non_canonical, belong to the owner (01, 07).

Rationale: two parsers that resolve duplicate members differently would see two different signed objects behind one valid signature.

6.6 Time claims

Times inside signed objects are NumericDate integers (00 §7.7). This profile applies to every type:

Claim Rule Error
iat REQUIRED. A JSON integer from 0 to 2^53 − 1 (no fraction, no exponent). Valid only if iat ≤ now + 60. Missing or not an integer: crypto.invalid_claims. iat > now + 60: crypto.not_yet_valid.
exp REQUIRED when the registry says "Required"; MUST be absent when it says "Forbidden"; MAY be present when it says "Optional". When present, an integer greater than iat, with exp − iat no more than the type's maximum lifetime. Valid only if now < exp + 60. Structure or lifetime: crypto.invalid_claims. now ≥ exp + 60: crypto.expired.
nbf Allowed only on a type whose owner defines it; then an integer not less than iat, valid only if nbf ≤ now + 60. On any other type a JWS that contains nbf MUST be rejected. Structure: crypto.invalid_claims. Present on a type that doesn't define it: crypto.invalid_claims (reason: "forbidden"). nbf > now + 60: crypto.not_yet_valid.

The 60-second allowance is the clock skew of 00 §7.7. It is applied once, here, with exactly these comparisons. Owners MUST NOT add more skew, and SHOULD cite this section rather than restate the comparisons; where an owner restates them, this section governs.

Rationale for rejecting an undefined nbf: generic JWT libraries enforce nbf whenever it is present. Ignoring it in some implementations and enforcing it in others would split verifiers.

Clock discipline.

  1. Servers SHOULD keep their clocks synchronized (for example with NTP) to within 1 s.
  2. The normative clock source for a client is the server: the HTTP Date header and the envelope ts (03 §2.3 item 4). A client MUST estimate its clock offset to each server it talks to, and MUST set iat (and exp, nbf) of every object it signs from the corrected time: the offset to the audience server for objects addressed to one (a DeviceProof), and the offset to its home server otherwise (an IdentityCertificate, DeviceCertificate or DeviceRevocation). Where an error carries data.serverTime, the client MAY use it as a further sample.
  3. On crypto.not_yet_valid, or an owner code that reports the same failure, a client corrects its offset, signs the object again and retries once.
  4. When a client verifies iat, exp and nbf itself (for example on an IdentityState), it uses its clock corrected by the offset measured against its own home server, not the raw device clock.
  5. A client MUST NOT show the user an error about clocks. After one automatic retry with the corrected time, a persistent failure is reported as a connection problem (20).

6.7 Signing procedure

To create a JWS of type T with key K:

  1. Build the payload with the owner's claims, including iat (and exp where required, within the maximum lifetime). Serialize it as UTF-8 I-JSON with no duplicate members.
  2. Build the header {"alg":"EdDSA","typ":T,"kid":kid(K)}.
  3. Compute b64-header and b64-payload with canonical base64url.
  4. Sign the ASCII signing input with Ed25519 (§4.2). Append "." || base64url(signature).
  5. Check that the result doesn't exceed the type's maximum size.

6.8 Verification procedure

To verify a JWS that the context expects to be of type T:

Step Check Failure
1 The compact string is no longer than T's maximum size. crypto.malformed (size)
2 It has exactly three non-empty parts separated by ., and the third is 86 characters. crypto.malformed (structure)
3 Each part decodes as canonical base64url (§3.1). crypto.malformed (encoding)
4 The decoded header is at most 1,024 bytes, is an I-JSON object, and has exactly alg, typ, kid, all strings. Over 1,024 bytes: crypto.malformed (size). Not an I-JSON object: crypto.malformed (json). Wrong members: crypto.header_rejected
5 alg is "EdDSA". crypto.unsupported_algorithm
6 typ equals T. crypto.wrong_type
7 kid matches the form for T's signer class. crypto.header_rejected
8 The payload is an I-JSON object meeting §6.5 items 1 and 2. More than 8 levels of nesting: crypto.malformed (depth). Otherwise crypto.malformed (json)
9 The key is selected and checked as §6.4 says (using the issuer claim from the payload where the class needs it), and passes §4.3 items 1 and 2. crypto.unknown_key or crypto.invalid_key
10 The signature verifies under §4.3 over the signing input. crypto.bad_signature
11 The time claims pass §6.6. crypto.invalid_claims, crypto.expired or crypto.not_yet_valid
12 The owner's claim checks pass (audience, jti replay, canonical addresses, revocation, and so on). The owner's codes
  1. A verifier MAY run the steps in any order, and MAY stop at the first failure, but MUST NOT accept unless every step passes. When several steps fail, it reports any one of their codes.
  2. Until step 10 passes, the verifier MUST NOT act on any claim except to select the key in step 9.
  3. Step 8 parses unauthenticated JSON. That is unavoidable for server-signed types, whose key depends on iss, and for IdentityCertificates (§6.10). The size limits bound the work.

Which code applies. Failures at steps 1 to 11 use the crypto.* code in the table, unless the owning document names a more specific code for that step (02, 06, 07, 15 and 19 do: 02 names discovery.unknown_key and discovery.key_unusable for step 9 with server keys where the type's owner names nothing more specific; for example 06 answers every HomeAssertion failure with 401 federation.assertion_invalid and a reason). Failures at step 12 always use the owner's codes.

  1. An owner MAY substitute its own codes, but MUST NOT relax or omit any check of §6.1 to §6.6. In particular, checking only that the header has no crit isn't enough: the header MUST have exactly alg, typ and kid (§6.2).
  2. An owner code that reports a time failure (step 11) SHOULD carry data.serverTime, as crypto.expired and crypto.not_yet_valid do.

6.9 Errors when a JWS is a credential

When the failing JWS is the request's authentication credential (an sv-s2s+jwt or sv-push+jwt in Authorization, or the HomeAssertion or DeviceProof in a session-creation request, 06), every crypto.* code is answered with HTTP status 401, whatever §15 lists. Otherwise the status is the one in §15. A server that fails to verify an object it fetched from a third party, rather than one the requester supplied, follows §15.1 item 4.

6.10 Self-certifying objects

An IdentityCertificate is signed by the identity key it contains. Verifying its signature proves only that whoever made it held that key. Therefore:

  1. To verify an IdentityCertificate, the verifier reads ik from the payload, requires kid to equal thumbprint(ik), checks ik with §4.3 items 1 and 2, and verifies the signature with ik.
  2. The verifier MUST NOT trust the binding of ik to sub from the IdentityCertificate alone. It MUST anchor ik independently, as 07 specifies: through a fresh IdentityState signed by the account's home server that carries this IdentityCertificate, through a HomeAssertion's ikf, or through the user's own pin.
  3. A DeviceCertificate or DeviceRevocation is only as trustworthy as the IdentityCertificate it is validated against.

6.11 Example

A test-type JWS (vector V-3), header and payload shown decoded:

{"alg":"EdDSA","typ":"sv-test+jwt","kid":"kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k"}
{"iss":"a.com","sub":"alice@a.com","iat":1764872400,"exp":1764872460,"jti":"Kc1o2Q8bTzR3fLw9yH0aVg"}

Compact form:

eyJhbGciOiJFZERTQSIsInR5cCI6InN2LXRlc3Qrand0Iiwia2lkIjoia1ByS19xbXhWV2FZVkE5d3dCRjZJdW8zdlZ6ejdUeEhDVHdYQnlnclM0ayJ9.eyJpc3MiOiJhLmNvbSIsInN1YiI6ImFsaWNlQGEuY29tIiwiaWF0IjoxNzY0ODcyNDAwLCJleHAiOjE3NjQ4NzI0NjAsImp0aSI6IktjMW8yUThiVHpSM2ZMdzl5SDBhVmcifQ.vshhA3eVTv2eXuwJOC4qjEREaJY-WmLoCbPsHkX8rq4Z07lMkPXNmGvvlE-GCMkgteOCD9_KGX7dTfTJ_z-5Aw

Owners usually report profile failures with their own codes (§6.8): for example, if a HomeAssertion's signature fails, 06 answers 401 federation.assertion_invalid with reason: "signature". §15.1 shows a crypto.* error in a case where no owner code applies.

7. Labelled signatures

7.1 Construction

A signature made with a DSK outside JWS and MLS is a labelled signature (00 §7.14):

SignLabelled(key, label, content)
    = Ed25519-Sign(key, "sv1 sig" || 0x00 || label || 0x00 || content)

VerifyLabelled(pub, label, content, sig)
    = Ed25519-Verify-Strict(pub, "sv1 sig" || 0x00 || label || 0x00 || content, sig)    ; §4.3
sig-label   = lc-alnum *31( lc-alnum / "-" )      ; ASCII, 1-32 characters, never contains 0x00
  1. label is the ASCII bytes of a registered label (§7.3), without quotes or terminator.
  2. content is a deterministic, injective binary encoding defined by the label's owner (§3.2). It is never JSON.
  3. In JSON, a labelled signature is the base64url of the 64-byte signature (86 characters).
  4. Only DSKs make labelled signatures in v1. An identity key MUST NOT make one (00 HP-1 item 7). A server key MUST NOT make one; server keys sign only JWS.

7.2 Rules for owners of content

Each owner defines its content structure. It MUST:

  1. contain every field whose integrity the signature is meant to protect, including the ciphertext or its hash where the signature covers encrypted data;
  2. bind the signature to where it belongs: the context or group, the object's own ID, and the epoch, call or other scope, so a valid signature can't be moved to a different object or context;
  3. be unambiguous as §3.2 requires, so two different field lists never produce the same bytes;
  4. start with a version field (uint8), so a later revision of the content can't be confused with this one.

7.3 Label registry

This document owns the registry.

Label Signed by content covers Owner
sealed DSK A SealedMessage's header fields and ciphertext 14
history-share DSK A HistoryShare: version, the hosting server's canonical domain, the context, the share ID, the sharer's and the recipient's canonical addresses, the sharing device's did, the range (fromSeq, toSeq), the item count, the bundle nonce and the bundle ciphertext (14 §7.5) 14
history-link — Reserved and retired. Formerly HistoryLinks and AnchorLinks, withdrawn by the revised D-007 (D-039 superseded). No v1 implementation signs or accepts it, and it MUST NOT be reused. 14
media-attest DSK A MediaAttestation: version, the context group's group_id, the MLS epoch, call ID, KID, first and last SFrame counter, and the 8-byte truncated hashes of each frame's SFrame metadata and ciphertext (18 §9.2, §9.4) 18
vault-box-key DSK A box key binding: the account's canonical address, the did, the identity generation and the X25519 box public key (08 §10.1) 08
vault-generation DSK A vault key generation (VaultGenerationTBS: account address, identity generation, vault generation, linked generation, kcv, link fields, IdentityState ver, creating did; 08 §10.2) 08
test Any Test vectors only; no production verifier accepts it 04

New labels are added as §8.7 describes.

7.4 Why the signing contexts can't collide

A DSK signs three kinds of input: JWS signing inputs (DeviceProof), labelled-signature inputs, and MLS SignWithLabel inputs. Their first bytes never overlap:

Input First byte
A JWS signing input that §6.8 accepts The first base64url character of a JSON object, which starts with { or white space: e, I, C or D
A labelled-signature input s (from "sv1 sig")
An MLS SignContent (RFC 9420 §5.1.2) The variable-length-integer length of "MLS 1.0 " + Label, which is a byte from 0x08 to 0x3F for every label RFC 9420 and 13 use

So no byte string is a valid signing input in two contexts, and a signature from one context can't be replayed in another. Inside labelled signatures, the label and the 0x00 separators keep labels apart.

8. Key derivation, MACs and hash labels

8.1 HKDF

  1. A key that is uniformly random and at least 32 bytes long MAY be used directly as the PRK of HKDF-Expand. This covers MLS exporter outputs, CSPRNG keys (K_vault, K_file), the Argon2id output, the CPace ISK, and outputs of earlier HKDF-Expand calls.
  2. An owner MAY instead run HKDF-Extract with a salt it defines before HKDF-Expand, for example to bind a public value into the PRK. The registry row (§8.4) then names the PRK exactly. No v1 label uses this option: 08 uses the Argon2id output and the CPace ISK directly as the PRK (item 1).
  3. Any other secret (for example a raw Diffie-Hellman output) MUST first go through HKDF-Extract with a salt its owner defines. sv1 has no such use outside MLS, CPace and HPKE, which have their own key schedules.
  4. Outputs in sv1 are at most 64 bytes.
  5. Each derived key has the single purpose its label names (§14.1).

8.2 HMAC

  1. A MAC or commitment is HMAC(K, label) or HMAC(K, label || 0x00 || context), following the layout of §8.3, with the label from §8.4.
  2. A MAC may be truncated only where the registry says so, and never below 16 bytes.
  3. Verifiers compare MACs, tags and commitments in constant time (§14.4).

8.3 Label grammar and separation

kdf-label   = "sv1 " word *( " " word )         ; at most 32 characters in total
word        = 1*( %x61-7A / DIGIT ) *( "-" 1*( %x61-7A / DIGIT ) )
  1. Every label is ASCII, starts with sv1 (D-025) and is used with exactly one primitive (HKDF-Expand, HMAC, SHA-256, SHA-512, or as an HPKE info) as the registry says. In addition, a label MAY prefix the AEAD associated data of a ciphertext encrypted under a key derived with that same label (08 does this with sv1 backup, sv1 vault and sv1 pair). Associated data is never key-derivation input, so this can't make two derivations collide.
  2. Info and message layout. The info (for HKDF and HPKE) or message (for HMAC and hashes) is:
    • label, when the derivation has no other input;
    • label || 0x00 || context, when it has other input, where context is an injective encoding (§3.2) defined by the label's owner.
  3. Exceptions fixed by 00. sv1 msg uses "sv1 msg" || mid with no separator, where mid is the 16-byte binary form of the message ID (00 HP-4). It is unambiguous because mid is exactly 16 bytes and the prefix sv1 msg is reserved: no other label may start with it (§8.7). sv1 dm uses 0x0A between the two addresses (§8.5, 00 HP-9), which is injective because a canonical address can't contain 0x0A.
  4. The separator rule makes every pair of labels unambiguous even where one label is a prefix of another (sv1 vault and sv1 vault id, sv1 vault and sv1 vault grant, sv1 pair and sv1 pair ci): after a shorter label comes 0x00 or the end of the input, never the space (0x20) or hyphen (0x2D) that continues a longer label. A hyphen only joins the parts of one word, as in sv1 history-share.

Rationale: two derivations from the same key with the same info give the same output. The separator rule makes "different purpose, same bytes" impossible by construction, without any owner having to check every other owner's inputs.

8.4 HKDF and HMAC label registry

This document owns the registry. Owners define context exactly, following §8.3.

Label Primitive Input key info or message Output Use Owner
sv1 ekid HKDF-Expand K_hist(e) "sv1 ekid" 8 bytes Epoch key ID 14
sv1 msg HKDF-Expand K_hist(e) "sv1 msg" || mid (16 bytes) 32 bytes K_msg 14
sv1 kc HMAC K_msg "sv1 kc" 32 bytes, truncated to 16 Key commitment kc 14
sv1 link — — — — Reserved and retired. Formerly the HistoryLink key, withdrawn by the revised D-007 (D-039 superseded). No v1 implementation derives it, and the label MUST NOT be reused. 14
sv1 anchor — — — — Reserved and retired. Formerly the AnchorLink key, withdrawn by the revised D-007 (D-039 superseded). No v1 implementation derives it, and the label MUST NOT be reused. 14
sv1 vault HKDF-Expand K_vault of one generation "sv1 vault" || 0x00 || context 32 bytes (8 for the key check value) Vault record keys, VaultKeyLink keys, key check values 08
sv1 vault id HMAC K_vid (08) "sv1 vault id" || 0x00 || context Truncated to 16 bytes Vault record IDs and buckets (keyed hash of group ID and epoch, 00 HP-4) 08
sv1 backup HKDF-Expand The Argon2id output (32 bytes), used directly as the PRK (§8.1 item 1; §12, 08 §5.3) "sv1 backup" || 0x00 || lv(addr) (08's lv) 32 bytes KeyBackup encryption key 08
sv1 pair HKDF-Expand The CPace ISK (64 bytes), used directly as the PRK (§8.1 item 1; §11, 08 §6.7.1) "sv1 pair" || 0x00 || u8(dir) (0x01 payload, 0x02 ack) 32 bytes Pairing payload and ack keys 08
sv1 file key HKDF-Expand K_file "sv1 file key" 32 bytes SVF1 encryption key K_enc (§10.2) 04
sv1 file kc HKDF-Expand K_file "sv1 file kc" 32 bytes SVF1 key commitment (§10.2) 04
sv1 cpace kc HKDF-Expand CPace ISK "sv1 cpace kc" 64 bytes Key-confirmation keys K_ca, K_cb (§11.5) 04
sv1 push collapse HMAC K_coll, a 32-byte random per-registration secret held by the home server (19 §10.3) "sv1 push collapse" || 0x00 || opaque(topic) 32 bytes, truncated to 16 Push collapse keys (19 §10.3) 19

Vector V-6 in §16 gives outputs for every row whose inputs this document or 00 fixes, and V-10 chains the Argon2id output into sv1 backup as a cross-check. The owners of sv1 vault, sv1 vault id, sv1 backup and sv1 pair (08) publish their own vectors.

8.5 Domain-separation strings for hashes, HPKE and CPace

String Primitive Input Use Owner
sv1 dm SHA-256 "sv1 dm" || 0x00 || P1 || 0x0A || P2, where P1 < P2 are the canonical addresses in byte order (00 HP-9) 1:1 DM context ID: dm: + base64url of the first 16 bytes 12
sv1 upgrade plan SHA-256 "sv1 upgrade plan" || 0x00 || scope || 0x00 || … (09 §10.6) Upgrade plan version 09
sv1 vault grant HPKE info "sv1 vault grant" || 0x00 || context (08 §10.3) VaultKeyGrant (§9.8) 08
sv1 history-share HPKE info "sv1 history-share" || 0x00 || mid16(shareId) || did16(did): the share ID and the recipient device's ID, 16 bytes each (14 §7.5) HistoryShare key wrap to one device's box key (§9.8) 14
sv1 pair ci CPace channel identifier §11.3 Binds the CPace run to the pairing session 04
sv1 init, sv1 resp CPace associated data §11.3 Role labels in ADa and ADb 04
sv1 safety SHA-512, iterated Initial value "sv1 safety" || 0x00 || u16(1) || ik || addr (the bytes 0x00 0x01 after the separator), then 5,200 rounds of h = SHA-512(h || ik) (07 §17.1) Safety-number halves (safety-number hash chain prefix) 07

Hashes of opaque data for integrity don't need a separator: the S2S body hash bh (06), MediaAttestation frame hashes (18), the BIP-39 checksum (08), and RFC 7638 thumbprints (§5.2) are defined by their owners or by external specifications. The safety-number hash chain (07) is not in this list: its initial input starts with the registered prefix sv1 safety (above), and the later rounds hash only the previous output and ik.

8.6 MLS exporter label registry

This document owns the registry. Every value is computed with MLS-Exporter(label, context, length) in the epoch whose secret is wanted.

Label Context Length Output Owner
sv1 history empty 32 K_hist(e) 14
SFrame 1.0 Base Key empty 16 (AEAD.Nk of cipher suite 0x0004, RFC 9605 §5.2) The SFrame epoch secret, used exactly as RFC 9605 §5.2 says 18
  1. sv1 implementations MUST NOT call the MLS exporter with any label not in this registry.
  2. New sv1 exporter labels start with sv1 . Labels defined by external specifications (such as RFC 9605) keep their own spelling.
  3. Exporter outputs follow their owner's retention rules. K_hist is kept beyond its epoch by design, so that a user's own devices can read what the user could read (D-007, D-054, 14 §3.7). The SFrame epoch secret is erased with the epoch's media keys (18).

8.7 Adding a label

A document that needs a new label, separator string, signature label or exporter label:

  1. chooses a name that matches the grammar of §7.1 or §8.3 and doesn't equal, or start with, a registered label followed by 0x00. The prefix sv1 msg is reserved: no other label may start with it (§8.3 item 3);
  2. defines it in its own text, with the exact input layout, and lists it in a "Registry additions" subsection (00 §7.15);
  3. publishes test vectors for it (§16).

The next revision of this document adds it to the registry. If two documents choose the same name for different purposes, this document resolves the conflict.

9. Authenticated encryption

9.1 Algorithm and encoding

All application-level encryption in sv1-c1 is AES-256-GCM with a 32-byte key, a 12-byte nonce and a 16-byte tag, used directly or inside HPKE (§9.8). (MLS and SFrame use their own cipher suites; TLS and DTLS are outside this document.)

  1. In every sv1 object, a ciphertext field holds the GCM ciphertext followed by the 16-byte tag. The nonce travels in its own field, or at a fixed position in a binary structure.
  2. Keys are 32 bytes, from the CSPRNG or from a registered derivation (§8.4). A key is never derived from a password except through Argon2id (§12) or CPace (§11).

9.2 Nonces

  1. Every AES-256-GCM encryption in sv1 uses a fresh 12-byte nonce from the CSPRNG, except inside SVF1 (§10), which uses a random prefix and a counter, SFrame (18), which follows RFC 9605, and HPKE (§9.8), whose single-shot nonce comes from its key schedule under a key that is fresh for every encryption.
  2. Outside the exceptions of item 1, nonces MUST NOT be derived from counters, timestamps, message IDs or other predictable values, and MUST NOT be all zero by default.
  3. A nonce is never reused under the same key. With random nonces, that is guaranteed by the usage bounds in §9.3.

9.3 Usage bounds per key

Key Maximum use Notes
K_msg (14) Exactly one plaintext One encryption. A resend in the same epoch reuses the stored bytes; a re-seal in a newer epoch uses that epoch's different K_msg (§9.6).
K_share (14) One bundle Fresh and random for every HistoryShare (14 §7.5).
Vault record keys (08) As 08 specifies; never more than 2^32 encryptions 08 SHOULD derive keys per record.
KeyBackup key (08) 2^32 encryptions The key stays the same while the phrase and salt do (§12.1), so it may encrypt many uploads, each with a random nonce.
Pairing payload and ack keys (08) 64 encryptions One pairing session.
SVF1 K_enc (§10) One blob, at most 2^32 segments Nonce uniqueness comes from the counter.
HPKE context of a VaultKeyGrant or a HistoryShare key wrap (§9.8) One encryption Single-shot; a fresh ephemeral key for every grant or wrap.
Any other AES-256-GCM key with random nonces 2^32 encryptions, and at most 2^36 − 32 bytes per encryption NIST SP 800-38D §8.3

An owner that adds an AES-256-GCM key MUST state its bound in its own text.

Rationale: at 2^32 random nonces the chance of a repeat is about 2^−33. Every sv1 key is used far fewer times than that, most of them once.

9.4 Associated data

AES-256-GCM associated data (AAD) MUST:

  1. be deterministic bytes: either an injective structure (§3.2) or the exact transmitted bytes of a binary header. It is never a re-serialized JSON object;
  2. include every cleartext field that travels with the ciphertext and that the recipient acts on (for example a SealedMessage's header fields, 14);
  3. bind the ciphertext to its place: the object kind, the context or group, the object's ID, and the epoch or key generation, so that the server can't move a ciphertext to another place where the same key would also decrypt it;
  4. not be empty.

The owner of each encrypted object defines its AAD structure under these rules. Two exceptions:

  • Fresh single-object keys. Item 3 doesn't apply to a key that is fresh, random and used for exactly one object, and that is delivered only inside an authenticated, place-bound object. The SVF1 K_enc (§10.2) is such a key: its placement is bound by the signed SealedMessage content that carries K_file, and the SVF1 AAD is the header alone (§10.4).
  • HPKE. In HPKE single-shot encryption (§9.8) the info string goes into the key schedule and carries the binding of items 2 and 3, so the AAD MAY be empty.

9.5 Key commitment

AES-GCM isn't key-committing: someone who chooses the key can make one ciphertext decrypt validly under two different keys.

  1. A ciphertext whose key may later be revealed to a third party MUST carry a key commitment. In sv1 that is every ciphertext a report can reveal (D-040): SealedMessages (kc, 14) and attachments (the SVF1 commitment, §10.2).
  2. Every party that decrypts such a ciphertext, including recipients that derive the key themselves, MUST check the commitment in constant time before decrypting, MUST treat a mismatch as a decryption failure (§9.7), and MUST NOT show the content.
  3. A commitment is at least 16 bytes and is computed with a registered label from the key alone.

Rationale for item 2: if recipients skipped the check, a sender could attach a wrong commitment to abusive content. Everyone would see the content, but every report of it would fail verification, so it could never be moderated.

9.6 Single-use keys and retries

  1. SealedMessages. A client MUST store the complete SealedMessage before its first send attempt. A retry in the same (generation, epoch) MUST send those identical bytes, and a client MUST NOT encrypt twice under one (generation, epoch, mid). When the server requires a newer epoch (14 §4.7), the client re-seals the identical content with the same mid under the new epoch's K_msg, a different key, with a fresh nonce, and stores the new bytes before sending. If the stored bytes are lost while the epoch is unchanged, the client creates the message again with a new mid.
  2. Attachments. A retried upload sends the same encrypted blob bytes. If they are lost, the client creates a new K_file and a new blob.
  3. A key derived for one object is never used for another object, even one with identical content.

Rationale: re-encrypting with a fresh nonce is safe for GCM, but two different ciphertexts under one K_msg would break the rule that a report reveals exactly one message, and edited text could slip into a "retry".

9.7 Decryption failures

  1. A failed AEAD operation releases no plaintext.
  2. A device never tells a remote party why decryption failed. Remote parties see at most that it failed (for example in a resync or report flow defined by the owner).
  3. Locally, the failure is recorded as a diagnostic with code crypto.decrypt_failed and a reason (§15.2). User-facing text belongs to 20.
  4. Streaming decryption of attachments follows §10.6.

9.8 HPKE

HPKE (RFC 9180) is used only to encrypt one key to one device's box key: a vault key (a VaultKeyGrant, 08 §10.3) or a HistoryShare's K_share (a key wrap, 14 §7.5).

  1. Mode base (0x00), KEM 0x0020 DHKEM(X25519, HKDF-SHA256), KDF 0x0001 HKDF-SHA256, AEAD 0x0002 AES-256-GCM. No other HPKE mode or algorithm is used.
  2. Single-shot only (SealBase / OpenBase, RFC 9180 §6.1): one encryption per HPKE context, with a fresh ephemeral key from the CSPRNG each time. The exporter interface isn't used.
  3. The info is "sv1 vault grant" || 0x00 || context for a VaultKeyGrant (08 defines context) or "sv1 history-share" || 0x00 || context for a HistoryShare key wrap (14 §7.5 defines context) (§8.5). The AAD is empty (§9.4).
  4. The recipient's box key is an X25519 key held by one device (§14.1). Before encrypting to it, the sender MUST check it, so that the server can't substitute its own key: for a VaultKeyGrant, its vault-box-key labelled signature as 08 §10.1 says; for a HistoryShare, that it equals (§5.1 rule 5) the dbk claim of the DeviceCertificate in the recipient device's MLS leaf, which the sender validated (07, 13, 14 §7.5).
  5. The enc is 32 bytes and the ciphertext is the plaintext length plus 16. A failure to open is crypto.decrypt_failed (tag, §15.2).

Vector V-12 in §16 gives a worked encryption; 14 §16.5 gives one for a HistoryShare key wrap.

10. Attachment encryption (SVF1)

10.1 Overview

In a secure context, every attachment blob, and every thumbnail or preview blob, is encrypted by the sending client with SVF1 (Sloppy Voice File, format 1) before upload (11). SVF1 is a STREAM-style segmented AES-256-GCM construction: the plaintext is cut into 64 KiB segments, each sealed separately, with a nonce that carries a segment counter and a final-segment flag. This lets clients encrypt while uploading, decrypt while downloading, seek with HTTP range requests, and detect truncation, reordering and appending.

In insecure contexts, attachments are uploaded as plaintext and aren't padded (11).

  1. The input to SVF1 is the raw file. The length prefix and the padding (§10.3) are part of SVF1; callers MUST NOT frame or pad the file separately, and the decrypted output is exactly the raw file.
  2. SVF1 authenticates the blob to whoever holds K_file, and every member who can read the message holds it. Integrity of the content against other members comes from the signed reference that carries K_file (the AttachmentRef's sha256 and size inside the SealedMessage, 11 §3.6, §14.3), which the receiving client checks after decryption.

10.2 Keys

  1. The sending client generates a fresh 32-byte file key K_file from the CSPRNG for every blob. A thumbnail has its own K_file. A K_file is never reused, not even for a re-upload of the same file (§9.6).
  2. From it, the client derives:
K_enc      = HKDF-Expand(K_file, "sv1 file key", 32)     ; AES-256-GCM key for every segment
commitment = HKDF-Expand(K_file, "sv1 file kc", 32)      ; key commitment in the header
  1. K_file travels only inside the SealedMessage content that references the attachment (11 defines the member). It reaches other people's devices only through that content, and the hosting server's moderators only through a report (D-040). It is never sent to a server in any other way.
  2. Devices cache K_file with the message. A user's new devices get it with the message, through the key archive (14 §12, 08 §9), and the recipient of a HistoryShare gets it inside the shared message's content (14 §7).

Rationale: separating K_enc from the commitment key keeps AES and HMAC-style uses of K_file apart, and a 32-byte commitment makes a forged report attachment as hard as a SHA-256 second preimage.

10.3 Framed plaintext and padding buckets

SVF1 frames the file and pads it to a bucket, so the server learns only an approximate size (00 §5.4):

F      = u64(len(file)) || file                  ; Lf = len(F) = len(file) + 8
P      = pad(Lf)                                 ; padded length
framed = F || 0x00 repeated (P − Lf) times       ; exactly P bytes

The padding function chooses the bucket:

pad(n) = 4096                              if n ≤ 4096
       = the smallest power of two ≥ n     if 4096 < n ≤ 65536
       = ceil(n / 2^(k−3)) · 2^(k−3)       if n > 65536, where 2^k < n ≤ 2^(k+1)

Properties:

  • The smallest bucket is 4 KiB. Up to 64 KiB, buckets are powers of two (4, 8, 16, 32, 64 KiB).
  • Above 64 KiB, each doubling of size has 8 buckets, so padding adds less than 12.5 %. For example, between 8 MiB and 16 MiB the buckets are 9, 10, 11, …, 16 MiB.
  • Every bucket above 4 KiB is a multiple of 4,096 bytes.
File size (bytes) Framed Lf Bucket P Segments Blob size (bytes)
0 8 4,096 1 4,155
20 28 4,096 1 4,155
4,088 4,096 4,096 1 4,155
4,089 4,097 8,192 1 8,251
10,000 10,008 16,384 1 16,443
65,528 65,536 65,536 1 65,595
65,529 65,537 73,728 2 73,803
100,000 100,008 106,496 2 106,571
1,000,000 1,000,008 1,048,576 16 1,048,875
8,388,608 (8 MiB) 8,388,616 9,437,184 144 9,439,531
26,214,400 (25 MiB) 26,214,408 27,262,976 416 27,269,675

SVF1 applies these buckets itself (§10.1 item 1). Document 11 decides when SVF1 is used and applies svf1Size (§10.7) to its limits.

Rationale: the length prefix makes the padding removable without scanning, and lets a streaming decryptor stop output at the right byte. Eight buckets per doubling keeps the upload cost low (on average about 6 %) while hiding exact sizes, which otherwise identify well-known files.

10.4 Blob format

struct {
    opaque magic[4];            // "SVF1" = 0x53 0x56 0x46 0x31
    opaque nonce_prefix[7];     // random, per blob
    opaque commitment[32];      // HKDF-Expand(K_file, "sv1 file kc", 32)
} SVF1Header;                   // 43 bytes

blob = SVF1Header || C_0 || C_1 || … || C_(n−1)
  • n = ceil(P / 65536). Segment i of the plaintext is framed[i·65536 .. min((i+1)·65536, P)]. Every segment is 65,536 bytes except possibly the last, which is from 4,096 to 65,536 bytes.
  • C_i = AEAD-Encrypt(K_enc, N_i, SVF1Header, segment_i): the segment ciphertext followed by its 16-byte tag. Every C_i is 65,552 bytes except possibly the last.
  • N_i = nonce_prefix || u32(i) || u8(f), where f = 1 for the last segment (i = n − 1) and f = 0 otherwise.
  • The AAD of every segment is the 43 header bytes.
  • Blob size: 43 + P + 16 · n.
  • Segment i starts at byte offset 43 + 65552 · i.

10.5 Encryption

  1. Generate K_file (32 bytes) and nonce_prefix (7 bytes) from the CSPRNG.
  2. Derive K_enc and commitment (§10.2). Write the header.
  3. Compute P = pad(len(file) + 8) and n.
  4. For i from 0 to n − 1, take segment i of framed and append C_i. A streaming encryptor knows n in advance because it knows the file length.
  5. Erase K_enc when done. Keep K_file for the message content.

10.6 Decryption

The decryptor knows the blob's total length B (from the download's Content-Length or the attachment metadata in 11). It MUST:

  1. require B ≥ 4155 and the first 4 bytes to be SVF1; otherwise fail with reason format;
  2. compute n = ceil((B − 43) / 65552) and require the last segment's ciphertext to be at least 4,096 + 16 bytes; otherwise format;
  3. derive commitment from K_file and compare it with the header in constant time; on mismatch fail with reason commitment before decrypting anything;
  4. decrypt each C_i with N_i, setting f = 1 only for i = n − 1; a tag failure fails with reason tag. (A truncated blob fails here, because its last present segment was sealed with f = 0. A blob with data appended fails because the final segment no longer verifies at its computed position, or is shorter than required.);
  5. from segment 0, read size = u64(framed[0..8]), and require P = B − 43 − 16·n to equal pad(size + 8); otherwise padding;
  6. output plaintext bytes framed[8 .. 8 + size] only, and require every byte of framed[8 + size .. P] to be zero; otherwise padding.

Every failure is crypto.decrypt_failed with the reason in parentheses above (§15.2).

Streaming and random access.

  • A client MAY pass the plaintext of each segment to an in-app media player as soon as that segment's tag verifies (for example to start playing a video), and MAY fetch and decrypt any segment independently with a range request.
  • A client MUST NOT present a saved file as complete, or hand it to another application, until every segment, including the final one, has verified and the output matches the signed size and sha256 of its AttachmentRef (11 §3.6, §14.3). It writes to a temporary location and moves the file into place only after success.
  • When streamed playback reaches the end, the client checks size and sha256 as above. On a mismatch it stops playback, discards what it decrypted and treats the attachment as failed (crypto.decrypt_failed, content_hash). Until that check, streamed content is only as trustworthy as any holder of K_file (§10.1 item 2, §18).
  • On a failure after partial output, the client stops the consumer and shows the generic attachment failure of 11 §14.3 (copy in 20). This is never a security warning (00 §4.12.5, D-055). It MUST NOT show the partial content as the file.

10.7 Sizes and server checks

  1. The largest blob for a plaintext limit M is svf1Size(M) = 43 + pad(M + 8) + 16 · ceil(pad(M + 8) / 65536). For the default maxAttachmentBytes of 25 MiB this is 27,269,675 bytes. Document 11 applies maxAttachmentBytes to the plaintext file and MUST accept secure-context blobs up to svf1Size(maxAttachmentBytes).
  2. A hosting server can't decrypt SVF1 but SHOULD check its structure at upload. With n = ceil((B − 43) / 65552) and P = B − 43 − 16·n, a blob of B bytes is well formed only if: B ≥ 4155; the first 4 bytes are SVF1; the last segment ciphertext B − 43 − 65552·(n − 1) is at least 4,112 bytes; and pad(P) = P. A blob that fails is refused with the endpoint owner's code where it names one; otherwise with crypto.malformed (reason: "length" for the length rules, "structure" for the magic). 11 uses crypto.malformed.
  3. Servers store and serve the blob bytes unchanged and MUST support range requests on them (11).

10.8 User-experience notes

  • The client starts encrypting and uploading as soon as the user picks a file, before the message is sent, so sending feels instant. The random K_file is what makes this possible: it doesn't depend on the message.
  • Thumbnails are small separate blobs, fetched first, so a conversation shows previews quickly.
  • Video and audio attachments can start playing in the app before the download finishes (§10.6).
  • Users see none of this. There is no "encrypting…" step in the interface; upload progress is shown as for any upload.

11. CPace profile

11.1 Pinned revision and parameters

Pairing (08, D-053) runs CPace between two devices of the same account, over messages relayed by the home server.

Parameter Value
Specification draft-irtf-cfrg-cpace-13, pinned. Where a later revision or RFC differs, this revision governs for sv1-c1.
Cipher suite CPACE-X25519-SHA512
Group X25519 (RFC 7748), generator from the pinned draft's calculate_generator with Elligator2 mapping
Hash H SHA-512, s_in_bytes = 128
DSI "CPace255" (as the pinned draft defines for this suite)
Mode Initiator-responder
Key confirmation Mandatory, as §11.5 defines
Functions used from the draft lv_cat, calculate_generator, sample_scalar, scalar_mult, scalar_mult_vfy, and the initiator-responder ISK derivation and transcript

An implementation MUST reproduce the pinned draft's own test vectors for CPACE-X25519-SHA512 (its Appendix B.1) before it implements this profile. The implementation used to compute V-11 reproduced the draft's generator, Ya, Yb, K and initiator-responder ISK vectors exactly.

Note for the lead: when CPace is published as an RFC, this document should cite the RFC instead of the draft, provided the RFC's CPACE-X25519-SHA512 vectors equal the draft's (so that V-11 doesn't change). If they differ, the move needs a new CPaceAD version (§11.3).

11.2 Roles

  • The initiator is the device on which the user enters the secret: the device that scans the QR code or on which the 6-digit code is typed.
  • The responder is the device that displays the QR code and the code.
  • Either role can be the enrolled device; pairing works in both directions (08). The device that holds the identity key sends the pairing payload, whatever its role.

Rationale: the initiator must know which secret the user used before it can compute the generator, and only the entering device knows that.

11.3 Inputs

Input Value
prs_kind 1 when the user scanned the QR code, 2 when the user typed the 6-digit code. Chosen by the initiator. In 08's cpace_a body it is cred: "qr" = 1, "code" = 2.
PRS For prs_kind = 1: the 16-byte secret from the QR payload (08 §6.3.1). For prs_kind = 2: the ASCII bytes of the 6 decimal digits, with leading zeros (for example "042917"). No kind byte is prepended; the kind is bound through CI.
CI (channel identifier) lv_cat("sv1 pair ci", u8(prs_kind), pairing_id, address), where pairing_id is the 16-byte binary form of the pairing session's UUIDv7 and address is the UTF-8 canonical address of the account.
sid pairing_id (16 bytes).
ADa The TLS encoding of CPaceAD { "sv1 init", 1, did_initiator } (below).
ADb The TLS encoding of CPaceAD { "sv1 resp", 1, did_responder }.
struct {
    opaque role<V>;      // "sv1 init" or "sv1 resp"
    uint8  version;      // 1: this profile
    opaque did[16];      // the sending device's ID, binary
} CPaceAD;               // 26 bytes: 0x08 || role || 0x01 || did

Each device obtains pairing_id, the account address, the expected peer did and the peer's role (approver or new device) from the pairing session (08). Each MUST check that the received AD has the expected role string, version = 1, and the did the session names for the peer, and abort otherwise. Which device is the approver follows from the did, so the AD doesn't repeat it.

Rationale: binding the session ID, the account and both device IDs means a relaying server can't splice two pairing sessions together or redirect a run to a third device. Putting prs_kind in CI means that changing it in transit just makes the run fail. The version inside both ADs enters ISK, so a later profile can't be confused with this one.

11.4 Messages and carriage

Document 08 owns the pairing message bodies (08 §6.6.2) and carries the CPace values in them, each base64url-encoded. The byte values are exactly those defined here; 08 MUST NOT define them differently.

08 message Sent by CPace values carried
cpace_a Initiator cred (prs_kind, §11.3), ya = Ya (32 bytes), ad = ADa (26 bytes)
cpace_b Responder yb = Yb (32 bytes), ad = ADb (26 bytes), tb (32 bytes)
confirm_a Initiator ta (32 bytes)
Step Device Action
1 Initiator Choose prs_kind from how the user entered the secret. g = calculate_generator(H, PRS, CI, sid). ya = sample_scalar(). Ya = scalar_mult(ya, g). Send cpace_a.
2 Responder Check a known cred; select PRS for that kind; check ADa (§11.3). Compute g, yb = sample_scalar(), Yb = scalar_mult(yb, g), K = scalar_mult_vfy(yb, Ya); abort if K is the neutral element (32 zero bytes). Compute ISK with the draft's initiator-responder derivation: `ISK = SHA-512(lv_cat("CPace255_ISK", sid, K)
3 Initiator Check ADb (§11.3). K = scalar_mult_vfy(ya, Yb); abort if neutral. Compute ISK, K_ca, K_cb. Verify tb in constant time; on mismatch abort without sending anything further except 08's abort. ta = HMAC(K_ca, transcript). Send confirm_a. The initiator's run is confirmed.
4 Responder Verify ta in constant time; on mismatch abort. The responder's run is confirmed.

transcript is the initiator-responder transcript of the pinned draft, lv_cat(Ya, ADa) || lv_cat(Yb, ADb). calculate_generator hashes the draft's generator_string("CPace255", PRS, CI, sid, 128) with SHA-512, keeps the first 32 bytes, clears the top bit, and maps the result with Elligator2 (RFC 9380). Vector V-11 gives every intermediate value.

11.5 Key confirmation

K_ca || K_cb = HKDF-Expand(ISK, "sv1 cpace kc", 64)       ; K_ca = first 32 bytes, K_cb = last 32
ta = HMAC(K_ca, transcript)
tb = HMAC(K_cb, transcript)
  1. Key confirmation is mandatory. A device MUST NOT derive the pairing payload key, or send or accept the payload, until its run is confirmed (step 3 for the initiator, step 4 for the responder).
  2. The tags are full 32-byte HMAC outputs.
  3. Sending tb first doesn't help an attacker: a party that doesn't know PRS learns from tb only whether its single guess was right.

11.6 Outputs

  1. A confirmed run yields ISK (64 bytes). Document 08 derives the pairing payload and ack keys from it with the sv1 pair label (§8.4).
  2. Each device erases ya or yb, K, K_ca and K_cb once its run is confirmed or aborted, and erases ISK once the pairing payload and ack keys are derived.

11.7 Failure and the one-attempt rule

  1. Any failure aborts the pairing session: a malformed message, an unknown cred, an AD with an unknown version or the wrong role or did, a neutral-element result, a tag mismatch, or a timeout set by 08.
  2. On abort both devices erase all CPace state and report the failure through 08's pairing codes. Locally the failure is recorded as crypto.pake_failed with a reason (§15.2).
  3. Each pairing session allows exactly one CPace run (D-053). A device MUST NOT start a second run in the same session, and MUST NOT accept a second cpace_a for it. Trying again needs a new session, with a new QR secret and a new code (08).
  4. User-facing text never says which device or which digit was wrong (20). Both screens say it didn't work and offer to try again.

Security property. Each device accepts one CPace run per session, so a party that doesn't know PRS, including the relaying home server, gets one guess against each device: it can pose as the responder to the initiator and as the initiator to the responder. Each guess succeeds with probability 10^−6 with a 6-digit code and 2^−128 with the QR secret. Only a correct guess against the approver exposes the pairing payload. The number of sessions is limited by user actions (the user has to start or approve each one), not by the home server's own rate limit, which a malicious home server ignores.

11.8 SPAKE2 fallback rule

00 §7.15 allows SPAKE2 (RFC 9382) only if this document records that CPace can't be pinned. CPace is pinned (§11.1), so sv1-c1 doesn't use SPAKE2. Implementations MUST NOT implement SPAKE2 for pairing as a fallback, and MUST NOT negotiate between PAKEs.

If CPace later becomes unusable for sv1 (a published attack on CPACE-X25519-SHA512 as pinned, or a defect in the pinned revision that can't be corrected without changing outputs), a revision of this document will define a pairing PAKE profile version 2 (signalled by new message types in 08, and carrying the version in its associated data as CPaceAD does) based on SPAKE2 with the RFC 9382 cipher suite SPAKE2-edwards25519-SHA256-HKDF-SHA256-HMAC-SHA256, using the two device IDs as idA and idB, CI as the additional authenticated data, and the same one-attempt rule. A session would run exactly one version, chosen by the initiator and bound into the transcript; there would be no fallback within a session.

12. Argon2id profile

12.1 Parameters

The KeyBackup key (08, D-052) is derived with Argon2id (RFC 9106).

Parameter Producers use Verifiers accept
Type Argon2id (y = 2) Argon2id only
Version 0x13 (19) 0x13 only
Memory m 65,536 KiB (64 MiB) 65,536 to 262,144 KiB
Passes t 3 3 to 10
Parallelism p 1 1 only
Salt 16 bytes from the CSPRNG Exactly 16 bytes
Tag length T 32 bytes 32 bytes only
Secret K empty empty
Associated data X empty empty
Password P Defined by 08. RECOMMENDED: the raw 10-byte recovery-phrase entropy, not the words. —
  1. The producer values are the floors of D-052. A client MUST refuse to use, and MUST refuse to create, an Argon2id computation with any parameter outside the "Verifiers accept" column, before running Argon2id. Locally the refusal is crypto.kdf_params_rejected.
  2. The upper limits stop a malicious or broken home server from setting parameters that exhaust a phone's memory or time. p is fixed at 1 because a different p changes the output and WebAssembly Argon2id is effectively single-threaded.
  3. A new random salt MUST be used whenever the recovery phrase changes. While the phrase stays the same, the salt MAY be reused, and a device MAY cache the derived key (08 §5.3), so that rewriting the KeyBackup doesn't need Argon2id again.
  4. The output is used only as the PRK of the sv1 backup HKDF-Expand (§8.4, 08 §5.3).

Rationale: hashing the decoded entropy instead of the typed words means that spelling, case and the "first four letters" shortcut can never change the key. With 80 bits of entropy, even a billion Argon2id guesses per second would take millions of years on average. Reusing the salt for the same phrase costs nothing: the salt exists to stop precomputation across accounts and phrases, not across uploads of the same backup.

12.2 The Argon2idParams object

Objects that store an Argon2id computation (the KeyBackup, 08) embed its parameters as an Argon2idParams JSON object:

Member Type Required Meaning Constraints
alg string Yes Algorithm "argon2id". Any other value: crypto.unsupported_algorithm.
v integer Yes Argon2 version 19
m integer Yes Memory in KiB 65,536 to 262,144
t integer Yes Passes 3 to 10
p integer Yes Lanes 1
salt string Yes Salt, base64url Exactly 16 bytes decoded

The output length is always 32 bytes and isn't carried. Unknown members are ignored.

{ "alg": "argon2id", "v": 19, "m": 65536, "t": 3, "p": 1, "salt": "EBESExQVFhcYGRobHB0eHw" }
  1. Every object that embeds Argon2id parameters uses Argon2idParams exactly, including v. The KeyBackup's kdf member (08 §5.1) is an Argon2idParams object.
  2. Owners MUST NOT define other ranges. A reader that finds a parameter outside §12.1 refuses before running Argon2id.
  3. A home server receiving an object that embeds Argon2idParams MUST check the parameters against §12.1 and refuse the upload if they fall outside. It answers with the endpoint owner's code where the owner names one (08 §5.1 names none and uses crypto.kdf_params_rejected and crypto.unsupported_algorithm); otherwise with 400 crypto.kdf_params_rejected, or 400 crypto.unsupported_algorithm for an unknown alg or v. It can't check the salt's randomness.

12.3 Performance and user experience

  • On current hardware, the producer parameters take about 0.2 to 1 s on a desktop, 1 to 3 s on a phone, and up to about 5 s in a browser using WebAssembly on a low-end device.
  • Clients run Argon2id off the user-interface thread (a background thread, or a dedicated Worker on the web), and show a plain progress message such as "Unlocking your messages…".
  • Argon2id never runs in a mobile notification extension (19); its memory budget is too small.
  • If the computation can't allocate its memory, the client says the device is short of memory and offers "Approve from another device" (pairing, 08), which needs no Argon2id on this device, as well as trying again. It MUST NOT retry with lower parameters.

13. Randomness

  1. Every key, seed, scalar, nonce, nonce prefix, salt, secret, jti, did, joinNonce and pairing code MUST come from the operating system's CSPRNG or a generator that is seeded from it and is safe across process forks and virtual-machine snapshots. Examples: getrandom(2) or getentropy(3), BCryptGenRandom, SecRandomCopyBytes, java.security.SecureRandom on Android, crypto.getRandomValues on the web, Go's crypto/rand.
  2. Implementations MUST NOT use non-cryptographic generators (Math.random, rand(), java.util.Random), timestamps, process IDs or counters as a source of secret or unpredictable values.
  3. If the CSPRNG fails or is unavailable, the operation MUST abort. There is no fallback. Locally this is crypto.rng_failure (§15.2).
  4. Deterministic randomness (for reproducing test vectors) MAY exist only in test builds and MUST NOT be reachable in production builds.
Value Size Generated by Owner
Ed25519 private key (identity key, DSK, server key) 32 bytes Key owner 07, 02
X25519 scalars inside MLS and CPace 32 bytes The MLS stack; CPace sample_scalar 13, §11
Box key and HPKE ephemeral key (X25519) 32 bytes The receiving device (box key); the granting or sharing device, per grant or key wrap (ephemeral) 08, 14, §9.8
K_vault 32 bytes An enrolled device 08
Recovery-phrase entropy 10 bytes The client at upgrade or reset 08
K_file 32 bytes The sending client, per blob §10
K_share 32 bytes The sharing client, per HistoryShare 14
SVF1 nonce prefix 7 bytes The sending client, per blob §10
AES-GCM nonce 12 bytes The encrypting device, per encryption §9
Argon2id salt 16 bytes The device writing the KeyBackup §12
Pairing QR secret 16 bytes The responder device 08
Pairing 6-digit code Uniform integer 0 to 999,999 (item 5) The responder device 08
jti 16 bytes or more The JWS issuer 06 and others
did 16 bytes Home server 05
joinNonce 4 bytes The calling client, per encryptor instance (each join, rejoin, media-process start and new SFU session, 18 §4.3) 18
UUIDv7 random bits (mid and other IDs) 74 bits Client or server 03
  1. Uniform integers. To draw an integer uniformly from 0 to N − 1 (for example N = 1,000,000 for a pairing code): draw 4 bytes as r = u32; if r ≥ floor(2^32 / N) · N, draw again; otherwise the result is r mod N. Taking r mod N without the rejection step is biased and MUST NOT be used.
  2. UUIDv7 random bits SHOULD come from the CSPRNG. They aren't secrets, but predictable IDs make other attacks easier.

14. Key handling

14.1 One key, one purpose

Key Type Held by May be used for MUST NOT be used for
Server signing key (purpose: "sign", 02) Ed25519 Server JWS of server-class types (§6.3) MLS, labelled signatures, TLS
MLS external-sender key (purpose: "mls-external-sender", 02) Ed25519 Hosting server External proposals in MLS (13) JWS, anything else
VAPID key (webPushKey, 02) ECDSA P-256 Home server VAPID JWTs to browser push services only (19) JWS of §6, anything else
Identity key Ed25519 Every enrolled device of the account sv-idcert+jwt, sv-devcert+jwt, sv-devrevoke+jwt only MLS, DeviceProof, labelled signatures, content, media
Device signing key (DSK) Ed25519 One device; never leaves it MLS leaf and handshake signatures; sv-devproof+jwt; labelled signatures (§7.3) Identity-class JWS
MLS HPKE and init keys X25519 One device MLS only (13) Anything else
Box key (08) X25519 One device; the private key never leaves it, and the public key is the dbk claim of its DeviceCertificate (07) Opening VaultKeyGrants and HistoryShare key wraps (HPKE, §9.8) only Anything else
K_hist(e) 32-byte secret Group members; key archive The sv1 ekid and sv1 msg derivations Direct encryption
K_msg 32-byte key Group members; the recipient of a HistoryShare that lists it (14 §7) One SealedMessage and its kc Anything else
K_share (14) 32-byte key The sharing device; the recipient account's devices Encrypting one HistoryShare bundle (14 §7.5) Anything else
K_vault (each generation) 32-byte secret The user's enrolled devices sv1 vault and sv1 vault id derivations, and what 08 defines for wrapping earlier generations Content, media
K_file 32-byte secret Members who can read the message sv1 file key and sv1 file kc derivations Direct encryption
Argon2id output 32-byte secret Transient PRK of sv1 backup (§8.4) only Anything else
CPace ISK 64-byte secret Transient sv1 cpace kc and sv1 pair only Anything else
SFrame keys 16-byte keys Call participants Media frames (18) Anything else
Transport keys TLS, DTLS Every client and server Transport (§2.4) Any account or content purpose

14.2 Storage

  1. A secret key at rest MUST be protected by the platform's strongest key store: held as a non-extractable platform key, or wrapped (encrypted with AES-256-GCM) under a non-extractable platform key. Examples: a Keychain or Secure-Enclave-protected wrapping key on Apple platforms, Android Keystore, DPAPI or CNG on Windows, the Secret Service on Linux where available, and a non-extractable WebCrypto key in IndexedDB on the web (D-065). Document 08 specifies each platform.

    Where no platform key store exists (for example headless Linux without a Secret Service), keys are kept in a file readable only by the running operating-system user (mode 0600 or equivalent), and the client records, for its diagnostics, that its key protection is software-only. A Bot client running on a server MAY instead take its wrapping secret from the operator's secret manager. Document 08 gives the per-platform details.

  2. Most platforms can't hold Ed25519 or X25519 private keys in hardware. Wrapping is therefore the normal case, and the wrapping AAD binds the key's purpose, the account's canonical address and the did (§9.4).

  3. The identity key must be extractable by design, because pairing and the KeyBackup move it (D-006). It is kept wrapped and unwrapped only for the rare operations that need it (issuing this device's DeviceCertificate, pairing out, updating the KeyBackup, signing a DeviceRevocation), then erased (D-065 states this for the web; every platform SHOULD follow it).

  4. A DSK or box key never leaves its device. It MUST NOT appear in a pairing payload, KeyBackup, AccountVault record or diagnostic, and SHOULD be non-exportable where the platform allows.

  5. Servers SHOULD keep signing keys in a hardware security module or key-management service, or at least apart from the main database, so that a database dump doesn't include them (21).

14.3 Erasing secrets

  1. Implementations MUST overwrite memory holding secret keys, seeds, scalars, passwords, PRS values and decrypted key material as soon as it is no longer needed, using the library's secure-erase facility where one exists (for example sodium_memzero).
  2. In garbage-collected languages, erasure is best effort: keep secrets in mutable byte arrays (never in immutable strings), overwrite them after use, and avoid copies.
  3. These values are erased immediately after use: the Argon2id output (unless the derived KeyBackup key is cached as §12.1 item 3 allows, in which case only that key is kept, in the local key store), the CPace scalars, K, ISK, K_ca and K_cb, the SVF1 K_enc, an HPKE ephemeral private key, a HistoryShare's K_share (once the sharer has built the share, or the recipient has stored its keys, 14 §7.5), an unwrapped identity key, and the plaintext of a pairing payload or KeyBackup once its contents are stored.
  4. Implementations SHOULD lock pages holding long-lived secrets in memory (mlock or the platform equivalent) where available, so they aren't written to swap.

14.4 Side channels

  1. MAC tags, AEAD tags, key commitments, CPace confirmation tags and any other secret-dependent comparison MUST be compared in constant time.
  2. Implementations MUST use primitives that run in constant time on their platform (AES with hardware instructions or a bitsliced implementation; constant-time X25519 and Ed25519).
  3. Custom code around the primitives MUST NOT branch on, or index memory with, secret values.

14.5 Logs, crash reports and diagnostics

Logs, crash reports, analytics and diagnostics (15) MUST NOT contain private keys, seeds, symmetric keys, plaintext of secure content, recovery phrases or their entropy, pairing secrets or codes, CPace values, or bearer tokens. They MAY contain public keys, thumbprints, ekid values, key IDs, error codes and reasons.

14.6 Libraries

Implementations SHOULD use widely reviewed cryptographic libraries (for example libsodium, BoringSSL or OpenSSL, the Go standard library, RustCrypto, platform WebCrypto) and MUST NOT implement the primitives of §2.1 themselves except where no such library exists for the platform. In every case they MUST pass the vectors of §16.

15. Error codes

15.1 crypto.* codes

This document owns the crypto area (00 §7.5). The error object is defined in 00 §7.9 and 03. The HTTP status below applies unless §6.9 makes it 401.

Code HTTP status retryable userAction Meaning data members
crypto.malformed 400 false none A cryptographic object or field can't be parsed: bad base64url, wrong decoded length, invalid or duplicate-member JSON, wrong structure, over the size limit, or nested too deeply. field (string, the member or object), reason (encoding, length, json, structure, size, depth)
crypto.header_rejected 400 false none A JWS header is missing typ or kid, contains a member other than alg, typ, kid, or has a kid of the wrong form for its signer class. member (string)
crypto.unsupported_algorithm 400 false update_app An alg other than EdDSA, or an unknown suite, format version or KDF algorithm (for example an SVF magic other than SVF1, or Argon2idParams alg/v). found (string)
crypto.wrong_type 400 false none A JWS typ isn't the one this context expects. expected, found (strings)
crypto.unknown_key 400 Server class: true. Identity and Device classes: false. Server class: retry. Otherwise none. kid doesn't resolve to an acceptable key of the expected signer, even after the one permitted metadata refetch. For the Server class retryAfterMs is 60,000, because the signer's metadata may still be propagating. For the Identity and Device classes a mismatched thumbprint is permanent. kid (string)
crypto.invalid_key 400 false none A public key is unusable: wrong JWK members (including d), non-canonical encoding, small order, or mixed order (§4.3 item 2). field (string)
crypto.bad_signature 400 false none An Ed25519 signature failed strict verification (§4.3 items 3 to 7), in a JWS or a labelled signature. typ or label (string)
crypto.invalid_claims 400 false none A time claim is missing, not an integer, present when forbidden (including nbf on a type that doesn't define it), ordered wrongly, over the maximum lifetime; or aud is an array. claim (string), reason (missing, type, forbidden, order, lifetime, array)
crypto.expired 400 true retry now ≥ exp + 60. The client obtains a fresh object automatically and retries once. exp (integer), serverTime (timestamp)
crypto.not_yet_valid 400 true retry iat or nbf is more than 60 s in the future. The client corrects its clock offset, signs again (§6.6) and retries once. claim (string), serverTime (timestamp)
crypto.kdf_params_rejected 400 false update_app Argon2id parameters outside §12.1. param (string)
  1. Receivers treat an unknown reason value as if no reason were given.
  2. Clients never show the text of a crypto.* error to the user. A retryable code is retried automatically, once; a persistent failure is shown with the generic copy that 20 defines for the failed action (for example "Couldn't connect to b.com. Trying again…").
  3. A server MUST NOT reveal, in detail or data, anything about secret values (for example which bytes of a tag differed).
  4. Objects from third parties. The codes and statuses above apply only when the failing object was supplied in the request being answered. When a server fails to verify an object it fetched or received from a third party while handling a request (an IdentityState from a home server, a peer's ServerMetadata keys, an IdentityState relayed with a commit), it MUST NOT answer its client with a crypto.* code. It answers with the owning document's code for an unavailable or misbehaving peer (for example 503 federation.issuer_unreachable, 06), and records the crypto.* code as a diagnostic.

Example: 11 refuses a secure-context attachment upload whose length no SVF1 blob can have (§10.7):

{
  "type": "urn:sloppyv:error:crypto.malformed",
  "code": "crypto.malformed",
  "title": "Malformed cryptographic object",
  "status": 400,
  "detail": "The blob length isn't a length SVF1 can produce.",
  "retryable": false,
  "retryAfterMs": null,
  "userAction": "none",
  "data": { "field": "blob", "reason": "length" }
}

15.2 Local diagnostic codes

These codes describe failures inside one device. They are never HTTP or WebSocket errors. They appear in local logs, SDK error values and the diagnostics a client uploads (15), with a reason:

Code Reasons Raised by
crypto.decrypt_failed tag, commitment, format, padding, content_hash AEAD and HPKE decryption (§9.7, §9.8), SVF1 (§10.6), and the AttachmentRef check after SVF1 (content_hash, §10.6)
crypto.pake_failed malformed, version, peer_mismatch, identity_element, confirmation, timeout CPace (§11.7)
crypto.rng_failure unavailable, error The CSPRNG (§13)

Owners MAY define more specific local codes in their own areas (for example for SealedMessage key-commitment failures in 14).

16. Test vectors

16.1 Where vectors live

  1. Machine-readable vectors live in spec/vectors/, one JSON file per document, named <NN>-<topic>.json (for example spec/vectors/04-crypto.json, spec/vectors/14-sealed.json). The directory and 04-crypto.json are generated from the vectors printed in §16.3 and are pending; until they exist, the printed vectors are the only source.
  2. The vectors printed in each document are normative. The JSON file MUST contain the same values. If they disagree, the document wins until the error is corrected.
  3. Every derivation and construction this document defines has vectors (§16.3). Owners publish vectors for their own derivations in the same format (00 §7.16).

16.2 File format

A vector file is an I-JSON object:

Member Type Required Meaning
format string Yes "sv1-test-vectors"
formatVersion integer Yes 1
suite string Yes "sv1-c1"
document string Yes The owning document number, for example "04"
vectors array Yes Vector objects

Each vector object:

Member Type Required Meaning
id string Yes Unique within the repository: <NN>-<name>-<n>, for example "04-thumbprint-1"
section string Yes The section of the owning document, for example "§5.2"
operation string Yes What is computed, for example "jwk-thumbprint", "ed25519-verify", "hkdf-expand", "svf1-encrypt"
description string No One line for humans
inputs object Yes Every input, including every value that would otherwise be random
expect string Yes "value" (compute outputs), "accept" or "reject"
outputs object or null Yes Expected outputs; null when expect is accept or reject, or while status is tbd
error string Only with reject The expected crypto.* (or owner) code
status string Yes "final", or "tbd" when the outputs aren't computed yet

Field encodings inside inputs and outputs:

  • a member name ending in Hex holds bytes as lowercase hexadecimal;
  • a name ending in B64 holds bytes as canonical base64url;
  • a name ending in Utf8 holds a text string whose UTF-8 bytes are the value;
  • other strings (a JWS, a typ, a label) are given exactly as they appear on the wire;
  • integers are JSON numbers; times are NumericDate integers named now, iat and so on;
  • a large input may be given as a generator, {"pattern": "i mod 251", "length": 100000} (byte i has value i mod 251), together with its SHA-256 as sha256Hex.
{
  "format": "sv1-test-vectors",
  "formatVersion": 1,
  "suite": "sv1-c1",
  "document": "04",
  "vectors": [
    {
      "id": "04-thumbprint-1",
      "section": "§5.2",
      "operation": "jwk-thumbprint",
      "description": "RFC 8032 test 1 public key",
      "inputs": { "publicKeyHex": "d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a" },
      "expect": "value",
      "outputs": { "thumbprintB64": "kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k" },
      "status": "final"
    },
    {
      "id": "04-ed25519-verify-3",
      "section": "§4.3",
      "operation": "ed25519-verify",
      "description": "Small-order public key; the cofactorless equation alone would accept",
      "inputs": {
        "publicKeyHex": "0100000000000000000000000000000000000000000000000000000000000000",
        "messageUtf8": "anything",
        "signatureHex": "01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
      },
      "expect": "reject",
      "outputs": null,
      "error": "crypto.invalid_key",
      "status": "final"
    }
  ]
}

16.3 Vectors

All outputs below are final. They were computed while writing this document with independent implementations: OpenSSL 3.5 through Python cryptography 50 for Ed25519, X25519, AES-GCM, HKDF, HMAC and Argon2id; separate Ed25519 point arithmetic for the edge cases (which reproduces RFC 8032 test 1 and V-3); a from-scratch implementation of the pinned CPace draft that reproduces its Appendix B.1 vectors, cross-checked with the library's X25519; and a from-scratch HPKE whose output the library's own HPKE decrypts. Line breaks inside long hexadecimal values below aren't part of the value.

The key K1 used in several vectors is RFC 8032 §7.1 test 1:

seedHex      = 9d61b19deffd5a60ba844af492ec2cc44449c5697b326919703bac031cae7f60
publicKeyHex = d75a980182b10ab7d54bfed3c964073a0ee172f3daa62325af021a68f707511a

V-1 base64url (§3.1).

Input Expect
bytes ff → encode "_w"
decode "_w" bytes ff
decode "_x" reject, crypto.malformed (encoding): non-zero unused bits
decode "_w==" reject, crypto.malformed (encoding): padding
decode "_" reject, crypto.malformed (encoding): length mod 4 = 1

V-2 JWK and thumbprint (§5).

JWK              = {"kty":"OKP","crv":"Ed25519","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo"}
thumbprint input = {"crv":"Ed25519","kty":"OKP","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo"}
thumbprint       = kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k

(The thumbprint matches RFC 8037 Appendix A.3.) A JWK for the same key that adds "d" is rejected with crypto.invalid_key.

V-3 JWS (§6). Signed with K1:

header   = {"alg":"EdDSA","typ":"sv-test+jwt","kid":"kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k"}
payload  = {"iss":"a.com","sub":"alice@a.com","iat":1764872400,"exp":1764872460,"jti":"Kc1o2Q8bTzR3fLw9yH0aVg"}
jws      = eyJhbGciOiJFZERTQSIsInR5cCI6InN2LXRlc3Qrand0Iiwia2lkIjoia1ByS19xbXhWV2FZVkE5d3dCRjZJdW8zdlZ6ejdUeEhDVHdYQnlnclM0ayJ9.eyJpc3MiOiJhLmNvbSIsInN1YiI6ImFsaWNlQGEuY29tIiwiaWF0IjoxNzY0ODcyNDAwLCJleHAiOjE3NjQ4NzI0NjAsImp0aSI6IktjMW8yUThiVHpSM2ZMdzl5SDBhVmcifQ.vshhA3eVTv2eXuwJOC4qjEREaJY-WmLoCbPsHkX8rq4Z07lMkPXNmGvvlE-GCMkgteOCD9_KGX7dTfTJ_z-5Aw
Case Expected typ now Expect
3a sv-test+jwt 1764872430 accept
3b sv-test+jwt 1764872521 reject, crypto.expired (now ≥ exp + 60)
3c sv-test+jwt 1764872339 reject, crypto.not_yet_valid (iat > now + 60)
3d sv-test+jwt 1764872430 The same payload with header typ sv-assert+jwt, validly signed: eyJhbGciOiJFZERTQSIsInR5cCI6InN2LWFzc2VydCtqd3QiLCJraWQiOiJrUHJLX3FteFZXYVlWQTl3d0JGNkl1bzN2Vnp6N1R4SENUd1hCeWdyUzRrIn0.eyJpc3MiOiJhLmNvbSIsInN1YiI6ImFsaWNlQGEuY29tIiwiaWF0IjoxNzY0ODcyNDAwLCJleHAiOjE3NjQ4NzI0NjAsImp0aSI6IktjMW8yUThiVHpSM2ZMdzl5SDBhVmcifQ.QIGkdBgdijY1dxjlVt4G0f9Lx_HPHHihud6Z13GrTw-h8-KaE_r1R8wDQpsXLU9-0jLBsrAK1r2AkLldFyhQBQ — reject, crypto.wrong_type
3e sv-test+jwt 1764872430 Header alg "none" (otherwise as V-3), signed with K1 — reject, crypto.unsupported_algorithm
3f sv-test+jwt 1764872430 Header that adds "jwk" holding K1's JWK, signed with K1 — reject, crypto.header_rejected
3g sv-test+jwt 1764872519 accept (now = exp + 59)
3h sv-test+jwt 1764872520 reject, crypto.expired (now = exp + 60)
3i sv-test+jwt 1764872340 accept (iat = now + 60)
3j sv-test+jwt 1764872430 Payload with a duplicate sub ("sub":"alice@a.com","sub":"mallory@a.com"), signed with K1 — reject, crypto.malformed (json)
3k sv-test+jwt 1764872430 V-3 with the last signature character w changed to x: the same 64 bytes under a lenient decoder, but non-canonical — reject, crypto.malformed (encoding)
3l sv-test+jwt 1764872430 Header {"alg":"EdDSA", + 1,000 spaces + "typ":"sv-test+jwt","kid":"kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k"} (1,087 bytes), payload as V-3, signed with K1; compact form 1,672 characters, SHA-256 3ed96590bdff924b09294f3ee2d95fbafaf7a074c79dfcb6b18f1cca68d0be24 — reject, crypto.malformed (size)
3m sv-test+jwt 1764872430 Header as V-3; payload as V-3 with ,"pad":" + 6,000 × a + " added before the closing }, signed with K1; compact form 8,350 characters, SHA-256 b3eb384413ed3a64e1d3fc3a878fd7233da3280eb6b3eac220e6d7dace1c7c80 — reject before decoding, crypto.malformed (size)
3n sv-test+jwt 1764872430 Payload with "nbf":1764872400 added after iat, signed with K1 — reject, crypto.invalid_claims (forbidden): sv-test+jwt doesn't define nbf
3o sv-test+jwt 1764872430 Payload with "aud":["b.com"] added after sub, signed with K1 — reject, crypto.invalid_claims (array)

Compact forms of the cases that aren't generated:

3e  eyJhbGciOiJub25lIiwidHlwIjoic3YtdGVzdCtqd3QiLCJraWQiOiJrUHJLX3FteFZXYVlWQTl3d0JGNkl1bzN2Vnp6N1R4SENUd1hCeWdyUzRrIn0.eyJpc3MiOiJhLmNvbSIsInN1YiI6ImFsaWNlQGEuY29tIiwiaWF0IjoxNzY0ODcyNDAwLCJleHAiOjE3NjQ4NzI0NjAsImp0aSI6IktjMW8yUThiVHpSM2ZMdzl5SDBhVmcifQ.QXaqRKNkdmMWYE4AqLmOP05fEyqSt4sKdRTP7GJTLXNoB7IdPHCQkhh1P2sphv9BuNwHOWJB11dMnHfPgdQ2Ag

3f  eyJhbGciOiJFZERTQSIsInR5cCI6InN2LXRlc3Qrand0Iiwia2lkIjoia1ByS19xbXhWV2FZVkE5d3dCRjZJdW8zdlZ6ejdUeEhDVHdYQnlnclM0ayIsImp3ayI6eyJrdHkiOiJPS1AiLCJjcnYiOiJFZDI1NTE5IiwieCI6IjExcVlBWUt4Q3JmVlNfN1R5V1FIT2c3aGN2UGFwaU1scndJYWFQY0hVUm8ifX0.eyJpc3MiOiJhLmNvbSIsInN1YiI6ImFsaWNlQGEuY29tIiwiaWF0IjoxNzY0ODcyNDAwLCJleHAiOjE3NjQ4NzI0NjAsImp0aSI6IktjMW8yUThiVHpSM2ZMdzl5SDBhVmcifQ.lQdrwk-KMsBju8bxJZhSv-p3hMYNczh_CIsBNMhl1rPgQEk6O9A_6KWIrTJi3ZznsQ5kq-q37u9qqG8k1D4gBg

3j  eyJhbGciOiJFZERTQSIsInR5cCI6InN2LXRlc3Qrand0Iiwia2lkIjoia1ByS19xbXhWV2FZVkE5d3dCRjZJdW8zdlZ6ejdUeEhDVHdYQnlnclM0ayJ9.eyJpc3MiOiJhLmNvbSIsInN1YiI6ImFsaWNlQGEuY29tIiwic3ViIjoibWFsbG9yeUBhLmNvbSIsImlhdCI6MTc2NDg3MjQwMCwiZXhwIjoxNzY0ODcyNDYwLCJqdGkiOiJLYzFvMlE4YlR6UjNmTHc5eUgwYVZnIn0.0nBqByotQe6arMbuFKau80_o0mr1yTCJdEfEUyx7oCDzWyUvveocd6mHK7hwmIdSuCILQf6Foa2GIt5vbsFSAw

3k  eyJhbGciOiJFZERTQSIsInR5cCI6InN2LXRlc3Qrand0Iiwia2lkIjoia1ByS19xbXhWV2FZVkE5d3dCRjZJdW8zdlZ6ejdUeEhDVHdYQnlnclM0ayJ9.eyJpc3MiOiJhLmNvbSIsInN1YiI6ImFsaWNlQGEuY29tIiwiaWF0IjoxNzY0ODcyNDAwLCJleHAiOjE3NjQ4NzI0NjAsImp0aSI6IktjMW8yUThiVHpSM2ZMdzl5SDBhVmcifQ.vshhA3eVTv2eXuwJOC4qjEREaJY-WmLoCbPsHkX8rq4Z07lMkPXNmGvvlE-GCMkgteOCD9_KGX7dTfTJ_z-5Ax

3n  eyJhbGciOiJFZERTQSIsInR5cCI6InN2LXRlc3Qrand0Iiwia2lkIjoia1ByS19xbXhWV2FZVkE5d3dCRjZJdW8zdlZ6ejdUeEhDVHdYQnlnclM0ayJ9.eyJpc3MiOiJhLmNvbSIsInN1YiI6ImFsaWNlQGEuY29tIiwiaWF0IjoxNzY0ODcyNDAwLCJuYmYiOjE3NjQ4NzI0MDAsImV4cCI6MTc2NDg3MjQ2MCwianRpIjoiS2MxbzJROGJUelIzZkx3OXlIMGFWZyJ9.PJScCAm0t71uMvOWAdZyZDj4EpQbw-bLs0PZnPVXJ_TL-DNFO8cqLmzm4V6h5uraJTQJplw-GL6qE38Pp45AAQ

3o  eyJhbGciOiJFZERTQSIsInR5cCI6InN2LXRlc3Qrand0Iiwia2lkIjoia1ByS19xbXhWV2FZVkE5d3dCRjZJdW8zdlZ6ejdUeEhDVHdYQnlnclM0ayJ9.eyJpc3MiOiJhLmNvbSIsInN1YiI6ImFsaWNlQGEuY29tIiwiYXVkIjpbImIuY29tIl0sImlhdCI6MTc2NDg3MjQwMCwiZXhwIjoxNzY0ODcyNDYwLCJqdGkiOiJLYzFvMlE4YlR6UjNmTHc5eUgwYVZnIn0.el-7193M9Nvb4DSrqrw_fL47GW-TgV7ZrJa779kbVRbxHIXx-rq11p4PsCsp6HJT7Yi2-rqw8PVlQRi2v3lCDQ

V-4 Ed25519 strict verification (§4.3).

Case Public key Message (UTF-8) Signature Expect
4a K1 empty e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901555fb8821590a33bacc61e39701cf9b46bd25bf5f0595bbe24655141438e7a100b accept (RFC 8032 test 1)
4b K1 empty e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e065224901554c8c7872aa064e049dbb3013fbf29380d25bf5f0595bbe24655141438e7a101b (4a with S + L) reject, crypto.bad_signature
4c 0100…00 (neutral element) anything 0100…00 ‖ 32 zero bytes reject, crypto.invalid_key
4d K1 small-order R 0100000000000000000000000000000000000000000000000000000000000000ceeca8b762ee441d37b3842b2d2e32d738c37475057b403a630ae08f05977509 (R = neutral element, S = k·a) reject, crypto.bad_signature
4e edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f (y = p, non-canonical) any any 64 bytes reject, crypto.invalid_key
4f 9158312a9a8d6e3b34c891d6d61444f8b8211c5117ebad15bdb0bd68b07e0245 (K1 plus a point of order 8: mixed order) mixed-order A 5247c4b0a20b529af6454b558ec0fbc53cce2548f049cb78f07ddf16e7c1923e8b50661b15deddb946c85061aecf048bce07bd240f2a29e243081c57069d1a06 reject, crypto.invalid_key (§4.3 item 2). The signature satisfies both the cofactorless and the cofactored equation.
4g K1 mixed-order R 48bc9f497aae1e2d9b088fb057d1c1f6fceede396e5fbdd2ee4a09484daff9889dae6b56ba33217da8a157f3f64a9f41724d1a2586e4a8c11ede5e2bab19a70c (R = [r]B plus a point of order 8, S = r + k·a) reject, crypto.bad_signature. The cofactored equation accepts it; the cofactorless equation rejects it. This is the case that splits verifiers (§4.3).
4h K1 non-canonical R eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f86ca47bf0a9e1b5ca2eda7c6b4b740de1c5e33c30c8e11324bf60a34c7672201 (R = the neutral element encoded with y = p + 1, S = k·a) reject, crypto.bad_signature (item 4). Both equations hold if R is decoded modulo p.
4i 0100000000000000000000000000000000000000000000000000000000000080 (x = 0 with the sign bit set) anything 0100…00 ‖ 32 zero bytes reject, crypto.invalid_key (item 1)
4j eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f (the neutral element encoded with y = p + 1) anything 0100…00 ‖ 32 zero bytes reject, crypto.invalid_key (item 1)
4k K1 empty e5564300c360ac729086e2cc806e828a84877f1eb8e5d974d873e06522490155edd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010 (4a's R with S = L) reject, crypto.bad_signature (item 6)

Cases 4c, 4d, 4f, 4h and 4j satisfy the cofactorless equation when the encodings are decoded leniently. While these vectors were being computed, OpenSSL 3.5's Ed25519 verification accepted 4c, 4d, 4f, 4i and 4j, which shows why §4.3's explicit checks are required around some libraries. Together with 4a to 4e, these cases cover the categories of Chalkias, Garillot and Nikolaenko ("Taming the many EdDSAs"): non-canonical and small-order A and R, mixed-order A and R, S ≥ L, and the cofactored/cofactorless split.

V-5 Labelled signature (§7). Key K1, label test, content the UTF-8 bytes of Sloppy Voice test content:

signedBytesHex = 73763120736967007465737400536c6f70707920566f696365207465737420636f6e74656e74
signatureHex   = 650e8ee3d8cb9a663878d44b804885ebcd842f6336c782fb33e21baea23c176b9125c0d306381f6775d7f0431d174998b494560b8651df6a812d26e29f96270f

V-6 Registered derivations (§8.4, §8.5).

K_hist         = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
ekid           = 6055c06d62559306                        (base64url YFXAbWJVkwY)
mid            = 01938f30-1b2c-7d4e-8f90-a1b2c3d4e5f6
mid16          = 01938f301b2c7d4e8f90a1b2c3d4e5f6
K_msg          = 45c1904c516af3bce29f9941e0ef08a864efaeb26a3840e1563e75e87e3f1ca4
kc             = 5a20ed32edbb23247c0b85ebfb45f493        (base64url WiDtMu27IyR8C4Xr-0X0kw)

P1 = alice@a.com, P2 = dan@d.com
SHA-256("sv1 dm" || 0x00 || P1 || 0x0A || P2)
               = 2815df6a03e82e54322aedd03a22df839f3e796e2c4e2c5a05ea5c4f627247a6
DM context     = dm:KBXfagPoLlQyKu3QOiLfgw

These are cross-checks of 00's formulas. Documents 14 and 12 own those derivations and their full vectors; if they differ from these values, the conflict is reported to the lead.

V-7 AES-256-GCM (§9). A fixed nonce is used only to make the vector reproducible.

keyHex        = 202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f
nonceHex      = 606162636465666768696a6b
aadHex        = 737631207465737420616164                 ("sv1 test aad")
plaintextHex  = 48656c6c6f2c20536c6f70707920566f69636521 ("Hello, Sloppy Voice!")
ciphertextHex = aaf1c1c79cfc5b06952b17cc6c6a25161b64fe23c0aaa28e0352f8f367b219bd81e409cc   (ciphertext || tag)

V-8 Padding (§10.3). The table in §10.3 is the vector set for pad() and the blob size.

V-9 SVF1 (§10).

Common inputs: K_file = 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f, nonce_prefix = a0a1a2a3a4a5a6.

K_enc      = fbcc8179e8bc121327aa3ffa2816f428050cc85f4042276eb673b262b8021858
commitment = 512e068e6006446da25aa1a2058965329806649257801d30bccfdd8df11059c3
header     = 53564631a0a1a2a3a4a5a6512e068e6006446da25aa1a2058965329806649257801d30bccfdd8df11059c3   (43 bytes)
Case File Blob length Checks
9a UTF-8 Hello, Sloppy Voice! (20 bytes) 4,155 One segment (final). Segment ciphertext starts b2a831adc2d30b5e7dd5a2a49d557ad35842e1c560776d6127604bcbf0fa3c82; tag ea3c830ce2ee996e8eb7991d41142cea; SHA-256 of the whole blob a1d3078d3c8d8467792086aac58042ce15f70eca8eb51c3423e52926450a617b
9b Generator i mod 251, length 100,000 (SHA-256 cd2df694e424bc7968cc37f47751019e5ca0cd1bdf2e479ea537c3a1c32ee1aa) 106,571 Two segments (65,536 and 40,960 bytes). Tag of segment 0 ffd3753d2350fb4b1133494825b51180; tag of segment 1 e8d9a0234806add850323a4cb83f24be; SHA-256 of the blob 5a936204d640649e8a3765e24d2461d6fb8a8616efdaff4ae30effddf5e66ef8
9c 9b truncated after segment 0 (the last 40,976 bytes removed, leaving 65,595 bytes) — reject, crypto.decrypt_failed (tag): segment 0 was sealed with f = 0
9d 9a decrypted with K_file whose last byte is XORed with 01 — reject, crypto.decrypt_failed (commitment)
9e 9b with 16 zero bytes appended (106,587 bytes) — reject, crypto.decrypt_failed (tag): segment boundaries no longer match

V-10 Argon2id (§12).

P      = 00010203040506070809          (10-byte phrase entropy)
salt   = 101112131415161718191a1b1c1d1e1f
m = 65536, t = 3, p = 1, T = 32, K = empty, X = empty, version 0x13
output = 44f27806a25cb5c97718d68b8654453dd843ee130bd4ab22d327ec16ca8dd504

Implementations SHOULD also reproduce RFC 9106 §5.3 (Argon2id), whose tag 0d640df58d78766c08c037a34a8b53c9d01ef0452d75b65eb52520e96b01e659 was reproduced by the same library. Parameters m = 32768 (below the floor) are rejected with crypto.kdf_params_rejected.

Cross-check of 08 §5.3, chaining this output into sv1 backup for the address alice@a.com (lv is 08's RFC 9420 variable-length prefix, here the single byte 0b). Document 08 owns this derivation; a difference is reported to the lead.

BK  = HKDF-Expand(output, "sv1 backup" || 0x00 || lv("alice@a.com"), 32)
    = dccf6081ff6d3f4e2df1616156e8aea9637b8b8b35b474dab6dc99fafedd033c

V-11 CPace (§11).

11a, key confirmation (final). With an illustrative ISK and transcript (lv_cat(32 × 0xaa, "ADa") || lv_cat(32 × 0xbb, "ADb")):

ISK        = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f
transcript = 20aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0341446120bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb03414462
K_ca       = 17d330412bfd7039f5638afc92b3c61637d1770cb4f63d68bbef3c59b213633d
K_cb       = abf1882d869d09d00386d67950077a6711246664572e4cb2794eada11b3dbec5
ta         = 3a78b2a00abed34480f56200500911201a3f56dafb889ecdb065005c09485ac8
tb         = 1a20b367931a8e6962875586fa7c39da978a316188b2a8d72c3f8f9f6a4a0c9a

11b, a full run with the 6-digit code. Inputs:

prs_kind      = 2 (code; 08 cred "code")
PRS           = "042917"                                   (ASCII, 303432393137)
pairing_id    = 01938f40-0000-7000-8000-000000000001
address       = alice@a.com
did_initiator = q2bS9xVg3m0yJpQe1vT0Aw  (ab66d2f71560de6d3226941ed6f4f403)
did_responder = Yx3kP0aL9qR2sT5uV8wZ1A  (631de43f468bf6a476b13e6e57cc19d4)
ya            = 21 repeated 32 times (hex), yb = 42 repeated 32 times (hex), as sample_scalar outputs

Outputs:

CI         = 0b737631207061697220636901021001938f400000700080000000000000010b616c69636540612e636f6d
gen_str    = 084350616365323535063034323931376f + 111 zero bytes
             + 2b0b737631207061697220636901021001938f400000700080000000000000010b616c69636540612e636f6d
             + 1001938f40000070008000000000000001                                    (189 bytes)
g          = 1cbaf1973b818afc8cd48e6a76867cc41da2ffd437c5efc30e133ff1f380a817
ADa        = 0873763120696e697401ab66d2f71560de6d3226941ed6f4f403
ADb        = 08737631207265737001631de43f468bf6a476b13e6e57cc19d4
Ya         = ae069078ff2b5d1520b0a1c7f6e9a0a7166fb84769278895f6891feab209c75c
Yb         = 143ace4647fe29eeb9bccb7882097db466e7188ae7580fb7f03137ca0fe8502a
K          = f811c4bd2de8b837728ca1ca7ff8178f12dd7985720be526445f38e8c3b92967
transcript = 20ae069078ff2b5d1520b0a1c7f6e9a0a7166fb84769278895f6891feab209c75c1a0873763120696e697401ab66d2f71560de6d3226941ed6f4f403
             20143ace4647fe29eeb9bccb7882097db466e7188ae7580fb7f03137ca0fe8502a1a08737631207265737001631de43f468bf6a476b13e6e57cc19d4
ISK        = 6094734e94ee5c19aee25f974026056ff18dd3cac91c004e94807046b53af0945c5e133d6a1bd6f125db07a2aa3743b96764007250b771835b1f49899ecccee3
K_ca       = 554f7bd78c6f9652bd3607be9ce170a35508c3d7e1c537145ee9d86543172b67
K_cb       = 7c2637f91a1d9f24b1ce62178e790969985eba98a1cd02dfacee2682f142e74e
tb         = 7ddedb2fb7652ed2672bd877530e08fdf0092bd6d72a0be98582f97406a3f794
ta         = 243f8175fabd757e32c1c2c6c71404eb69b9aa2c7559548de585da926506a036

The values as 08 carries them (§11.4):

{ "cred": "code", "ya": "rgaQeP8rXRUgsKHH9umgpxZvuEdpJ4iV9okf6rIJx1w", "ad": "CHN2MSBpbml0Aatm0vcVYN5tMiaUHtb09AM" }
{ "yb": "FDrORkf-Ke65vMt4ggl9tGbnGIrnWA-38DE3yg_oUCo", "ad": "CHN2MSByZXNwAWMd5D9Gi_akdrE-blfMGdQ", "tb": "fd7bL7dlLtJnK9h3Uw4I_fAJK9bXKgvphYL5dAaj95Q" }
{ "ta": "JD-Bdfq9dX4ywcLGxxQE62m5qix1WVSN5YXakmUGoDY" }

11c, the same run with the QR secret 000102030405060708090a0b0c0d0e0f (prs_kind = 1, cred "qr"), all other inputs as 11b:

CI   = 0b737631207061697220636901011001938f400000700080000000000000010b616c69636540612e636f6d
g    = 4409d49936ae86c1278167caa5451517e51bc7f3278820b8ee8bf80932123d53
Ya   = 76bdfdeb46fcfc122e5b8dac17ca69f9b8c57cfb52e18b6a15e7a5b32fd89e56
Yb   = 82b5866cebd48134bf011d543ff8797b8d2ef24477a5a20655b7b045fe9fb920
K    = 1e82d6c4e6b8e07edbd3e53015a69e9627c1b4b7a5d3d068fa9c2e3fe7d09033
ISK  = 86ceb1fb96b346a2905de1181975731dc5af17d622f3ba050306336634bbd3cf5e7a2a12cb0376f4b88c1322dffe0a6c05060680309578a30f8f45dbe43a2ab6
K_ca = 661dcc7f07b3b71d39e8e2d1205c923e64a1125b91be3ab38118729626f9b33d
K_cb = e01120fb51337f207f7fc29dcd778acf8f065dc6093ef0125dd6d8d8e0b139d8
tb   = bc9112373d1e1a014a5fcf98da17153b2bc188e3ccef16ea9a40a0f9169f9c75
ta   = 42fb0a2b0a38d83c1a3a94c57a66bc029fddb9cb25645ca585cc4ad233c8e343

11d, negative: as 11b, but the user typed 042918 on the initiator. The initiator's generator is cd734cb9a69211d77cfa6dfe63ecf024fab5deb28b1ac7b44dfdbf10ce68800e and its Ya is 10f20e6eed6e355ad36d835211af580e61015f6cfef9733ae7ad648acd832d44. The responder (using 042917) computes K = 74be8c71da8613e9d870713362ce81c35b12db3472aa01aefdb9155e29215849 and sends tb = 61c845cf4556524d54a461d9d603b1f6daad11599c218ad979078a23e90bbe08. The initiator computes K = f811c4bd…b92967 (as 11b), so tb doesn't verify: abort, crypto.pake_failed (confirmation), and the initiator sends no confirm_a.

V-12 HPKE (§9.8). Base mode, KEM 0x0020, KDF 0x0001, AEAD 0x0002, single-shot, empty AAD. The info uses 08's VaultKeyGrant layout (lv = 08's RFC 9420 variable-length prefix) for alice@a.com, did q2bS9xVg3m0yJpQe1vT0Aw, igen 1, vgen 2; 08 owns that layout.

skR    = 808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f   (box key, private)
pkR    = 493e82fc74464a59268817623d2053c5eb8e2cc4a988b4fee179ec6b010d531d
skE    = 606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f   (ephemeral; fixed only for the vector)
info   = 737631207661756c74206772616e74000b616c69636540612e636f6dab66d2f71560de6d3226941ed6f4f4030000000100000002
pt     = 404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f   (K_vault)
enc    = 675dd574ed7789310b3d2e7681f3790b466c773b1521fecf36577958371ea52f
shared_secret = 435d4ede5de061039208a7b4802f97f9303c26dcb484f312b8954ee4b89ab155
key    = 87d0aa0d6e4df13d88afd387eeb2c7fdcf65cdaff344796c78e13db0f71e0ce5
nonce  = 30a7d6d35d123fe21887d58c
ct     = 98ae5303763e7ee0e4e6fe6088aaf0dcb810b22c043ca478e710926363b0158c2efeb55ada6d088f2d27fe58b50f1d4e   (48 bytes)

17. Crypto agility and the post-quantum path

17.1 Principles

  1. Algorithms change only by a new suite, never by negotiation inside one (§2.2).
  2. A suite is chosen per object or per context when it is created (an MLS group's ciphersuite, a KeyBackup's parameters, an attachment's format), and then pinned. It is never downgraded, in the same way that a secure context is never downgraded (D-056).
  3. Every object that may change format already carries a version (§2.2 item 3), so a new suite needs no new negotiation field.

17.2 Where a new suite plugs in

Surface In sv1-c1 How a later suite changes it
JWS alg: EdDSA, Ed25519 keys New signature algorithms come with new typ values (for example sv-idcert2+jwt) registered here. v1 verifiers reject them (§6.2).
Labelled signatures Ed25519 DSKs, prefix "sv1 sig" A new key type gets its own prefix.
HKDF, HMAC, hashes SHA-256 Unchanged; these are already adequate against quantum attackers.
MLS Ciphersuite 0x0001 A new ciphersuite per group. A context moves by starting a new group generation (the decimal suffix of group_id, 13), only once every member device supports it.
SFrame 0x0004 Follows the MLS group; a later suite may use AES_256_GCM_SHA512_128 (0x0005).
Attachments SVF1 A new magic (SVF2).
KeyBackup Argon2idParams alg, v New values.
Pairing CPaceAD version 1 A new profile version, with new message types in 08.
VaultKeyGrants and HistoryShare key wraps HPKE 0x0020/0x0001/0x0002 A hybrid KEM, signalled by new grant fields in 08 and a new HistoryShare version in 14.

Proposed decision: Future suites are advertised by their suite ID (for example sv1-c2) in ServerMetadata features (02, 03) and in the client's session.hello features; sv1-c1 is implied and never listed. A context uses a newer suite only when its hosting server and every member device advertise it. Rationale: reuses the existing feature mechanism, keeps the choice per context, and introduces no per-message negotiation.

17.3 The post-quantum path (informative)

What is at risk.

  • Confidentiality, now. An attacker who records traffic today and later has a cryptographically relevant quantum computer could break X25519. That exposes MLS epoch secrets, and with them K_hist, every SealedMessage, attachment key and SFrame key of the recorded groups, and recorded VaultKeyGrants and HistoryShare key wraps (HPKE to X25519 box keys). It also exposes recorded pairing transcripts run with a 6-digit code: with discrete logarithms solved, each of the 10^6 codes can be tested offline, revealing the pairing payload, which contains the identity key. Pairing with the QR code's 128-bit secret stays out of reach.
  • Authenticity, later. Ed25519 signatures could be forged once such a computer exists, but not retroactively. Signatures made before then stay trustworthy.
  • Unaffected. AES-256-GCM, SHA-256, HKDF, HMAC and Argon2id. The KeyBackup (80-bit entropy, Argon2id, AES-256) stays safe: a quantum search would still need about 2^40 sequential Argon2id evaluations of 64 MiB each. AES-128 in MLS 0x0001 and SFrame keeps a margin of about 2^64 against quantum search, which is acceptable for v1 but is raised in the next suite.

Planned sv1-c2 (hybrid, confidentiality first).

  1. An MLS ciphersuite with a hybrid KEM combining X25519 and ML-KEM-768 (as standardized for MLS by the IETF), keeping Ed25519 signatures so that identities don't change.
  2. SFrame with a 256-bit AES suite derived from that group.
  3. Pairing with a hybrid PAKE: CPace plus an ML-KEM encapsulation bound into the transcript, or a standardized post-quantum PAKE if one exists by then.

Later (sv1-c3 or protocol version 2). Hybrid signatures (Ed25519 plus ML-DSA-65) for server keys, identity keys and DSKs. Moving an identity to a new key type needs an identity rollover, which D-072 defers until after v1.

Until then. Clients SHOULD offer pairing by QR code first and the 6-digit code second (20), because only the QR path resists recorded-transcript attacks.

17.4 Requirements on v1 implementations

  1. Reject every unknown suite, algorithm, format version and parameter set (§2.2).
  2. Keep primitive choices isolated in code, so that adding a suite doesn't touch protocol logic.
  3. Never accept, produce or "try" a sv1-c2 object.

18. Security considerations

  1. One profile closes the JOSE pitfalls. A fixed alg, a mandatory exact typ, a three-member header, context-derived keys and a kid that is only a cross-check rule out algorithm confusion, embedded or remote keys, crit games and cross-type substitution (a valid HomeAssertion presented as an S2S token, for example).
  2. Parser differentials. Duplicate JSON members, non-canonical base64url and re-serialized JSON can make two implementations see different content behind one signature. §3 and §6.5 forbid all three.
  3. Ed25519 edge cases. Libraries disagree on small-order and mixed-order keys, non-canonical encodings and the cofactor. §4.3 fixes one strict, deterministic rule set, and V-4 shows that a common library accepts signatures the rule rejects. A library less strict than §4.3, used without the required wrapping, remains a residual risk (22).
  4. Self-certifying objects. An IdentityCertificate proves only possession of its own key. Treating its sub as authenticated without an IdentityState, HomeAssertion or pin would let anyone mint an identity for any address (§6.10).
  5. Clock skew. The 60-second allowance widens every validity window by up to 2 minutes. The maximum lifetimes in §6.3 already account for it; single-use jti (06) covers replay within the window.
  6. AES-GCM is not key-committing. Wherever keys can be revealed to third parties (reports), a commitment is mandatory, and every party that decrypts checks it (§9.5). SealedMessage commitments are 16 bytes (14): a forger who reveals a fake K_msg needs a second preimage of truncated HMAC-SHA256 (about 2^128 work). The sender can't exploit the truncation because K_msg is derived by every recipient, not chosen by the sender. If recipients didn't check the commitment, a sender could make abusive content unreportable by attaching a wrong one; §9.5 item 2 closes that. A HistoryShare (14 §7) hands K_msg values to one recipient, who checks each against the sender's signed kc before use, exactly as a report verifier does.
  7. Nonce reuse. Random 96-bit nonces are safe within the bounds of §9.3. SVF1 uses a counter under a per-blob key, so uniqueness is structural. The final-segment flag stops truncation and extension.
  8. Attachment sizes. Padding hides exact sizes but not size classes; a server still learns roughly how large an attachment is, and the number of attachments (00 §5.4).
  9. Streamed attachments. SVF1 authenticates a blob to every holder of K_file, which includes every member who can read the message. A member working with the hosting server can therefore replace a blob with a different, validly encrypted one under the same key. The signed sha256 in the AttachmentRef catches this, but only once the whole file has been decrypted. Until then, content played while streaming (§10.6) could be such a replacement. This is an accepted residual risk of v1 (22): saved files and files handed to other applications are always checked first, and playback stops when the final check fails.
  10. Pairing. Each device accepts one CPace run per session, so a relaying home server gets one online guess against each device (1 in 10^6 with the code), and only a correct guess against the approver exposes the payload (§11.7). The home server's own rate limit doesn't bound a malicious home server; the number of attempts is bounded by how often the user starts or approves pairing, and every attempt needs the user to act on a device. Binding the session, account and both device IDs into CPace stops splicing and redirection.
  11. Recovery-phrase guessing. An attacker with the KeyBackup (for example a malicious home server) faces up to 2^80 Argon2id evaluations, 2^79 on average. The parameter ceilings stop a malicious server from denying restores by setting absurd parameters, but not from deleting the backup.
  12. Weak randomness breaks everything at once. §13 forbids fallbacks; a failed CSPRNG aborts.
  13. Key exposure on devices. The identity key is on every enrolled device and must be extractable for pairing; a compromised device gives it up. Wrapping under platform keys and short unwrap windows limit casual exposure, not a full device compromise. DSKs and box keys never leave their device, so a stolen DSK is one revocable leaf (07). Devices without a platform key store (§14.2) have software-only protection.
  14. Labelled-signature and context separation. The first-byte argument of §7.4 means a DSK signature can't be moved between JWS, labelled and MLS contexts. Owners must still bind each content to its context (§7.2), or a signature could be moved between objects of the same kind.
  15. Quantum attackers. Recorded MLS traffic, VaultKeyGrants, HistoryShare key wraps and code-based pairing transcripts are at risk from a future quantum computer (§17.3). v1 accepts this risk; sv1-c2 addresses confidentiality first.
  16. Errors about third-party objects. A server never blames its client with a crypto.* code for an object it fetched from someone else (§15.1 item 4), so a misbehaving peer can't make an honest client look at fault or retry pointlessly.
  17. Insecure accounts. D-060 allows transport keys for insecure accounts. They give no end-to-end protection: insecure contexts rely on TLS and DTLS hop by hop, and the servers involved can read everything (00 §5.1).

19. Open questions

  1. Padding overhead. Above 64 KiB, SVF1 adds up to 12.5 % (about 6 % on average) to secure uploads, which costs mobile data. Recommendation: keep 8 buckets per doubling; the privacy gain over 16 buckets is worth the cost, and the overhead is invisible in normal use.
  2. Post-quantum timing. Should sv1-c2 (hybrid MLS, §17.3) be a v1.x goal, given that harvest-now-decrypt-later applies to secure content today? Recommendation: yes, as soon as an IETF MLS hybrid ciphersuite and at least two open-source MLS libraries support it; until then, prefer QR pairing.

20. References

20.1 Normative

  • RFC 2104 — HMAC
  • RFC 2119, RFC 8174 — requirement key words
  • RFC 4648 — base64url
  • RFC 5234 — ABNF
  • RFC 5869 — HKDF
  • RFC 7493 — I-JSON
  • RFC 7515 — JSON Web Signature (JWS)
  • RFC 7517 — JSON Web Key (JWK)
  • RFC 7519 — JSON Web Token (JWT)
  • RFC 7638 — JWK thumbprint
  • RFC 7748 — X25519
  • RFC 8032 — Ed25519
  • RFC 8037 — EdDSA in JOSE
  • RFC 8259 — JSON
  • RFC 8446 §3 — TLS presentation language
  • RFC 9106 — Argon2
  • RFC 9180 — Hybrid Public Key Encryption (HPKE), for VaultKeyGrants and HistoryShare key wraps (§9.8) and inside MLS
  • RFC 9380 — Hashing to elliptic curves (Elligator 2, used by CPace)
  • RFC 9420 — Messaging Layer Security (MLS)
  • RFC 9457 — Problem details for HTTP APIs
  • RFC 9562 — UUIDs (UUIDv7)
  • RFC 9605 — SFrame
  • draft-irtf-cfrg-cpace-13 — CPace (pinned revision)
  • NIST SP 800-38D — GCM
  • FIPS 180-4 — SHA-256 and SHA-512
  • FIPS 197 — AES
  • 00-overview.md — architecture and conventions (§7)
  • 03-transport.md — error object, error registry, feature registry

20.2 Informative

  • RFC 7636 — PKCE
  • RFC 7797 — JWS unencoded payload option (forbidden here)
  • RFC 8030, RFC 8291, RFC 8292 — Web Push, its encryption, VAPID
  • RFC 9382 — SPAKE2 (fallback rule only, §11.8)
  • RFC 9750 — MLS architecture
  • ZIP-215 — permissive Ed25519 validation rules (not used)
  • Hoang, Rogaway, Shrimpton, Reyhanitabar, Vizár — "Online Authenticated-Encryption and its Nonce-Reuse Misuse-Resistance" (the STREAM construction)
  • Dodis, Grubbs, Ristenpart, Woodage — "Fast Message Franking: From Invisible Salamanders to Encryptment" (key commitment)
  • Chalkias, Garillot, Nikolaenko — "Taming the many EdDSAs" (Ed25519 validation differences; the categories V-4 covers)
  • BIP-39 — mnemonic word list (08)
  • FIPS 203 (ML-KEM), FIPS 204 (ML-DSA) — post-quantum path
  • spec/DECISIONS.md — decision log