Zcash ZIPs
Theme
Appearance
Contents

Unnumbered proposal

Xiphos: Diversifiable Kopis

Draft

Terminology

The key words “MUST”, “MUST NOT”, and “MAY” in this document are to be interpreted as described in BCP 14 1 when, and only when, they appear in all capitals.

A diversifier is a fixed-length byte string selected by an application to identify one public key derived from a secret key. Diversifiers may be public and/or predictable.

The following definitions and conventions are imported from Kopis 2:

The additional pseudocode notation Fn denotes a closure type; Result, Ok, and Err denote success or failure, and is_ok() tests for success. constant_time_equal compares byte strings without data-dependent timing, and boolean & evaluates both operands without short-circuiting.

We also define the following security property:

Abstract

Xiphos adds public-key diversification to Kopis 2. A single secret key can produce multiple diversified public keys, indexed by a diversification string d. This enables a user to give out multiple seemingly-independent public keys, while being able to efficiently decapsulate received KEM ciphertexts without needing to maintain a list of issued public keys.

Motivation

Public-key diversification is the ability to derive multiple public keys from the same secret key, such that a ciphertext encrypted to any of the public keys can be decrypted by a single secret key. It is not necessary for most cryptographic protocols, and thus is missing from standards and libraries. However, it is relatively trivial to construct for elliptic curves using group hashing (also known as hash-to-curve). Any deterministically-selected generator known to both parties can be used for standard ECDH key agreement; if the input to the group hash is diversified with some identifier, multiple independent generators are obtained, enabling the same secret key to be used while gaining unlinkability against classical adversaries.

The same property is seemingly impossible to obtain from the now-standardised post-quantum primitives. Despite various efforts over the past decade such as the NIST Post-Quantum Cryptography Sandardisation competition, no efficient post-quantum key agreement mechanisms (with the nice algebraic properties that ECDH relies upon) have been found. Instead, the industry has standardised several post-quantum KEMs.

On its face, the KEM interface should be compatible with diversification. However, the most performant standardised post-quantum KEMs use implicit rejection, which means that the public key is re-derived from the secret key, and then the decrypted secret is re-encrypted to verify the ciphertext. For public-key diversification, we do not know which public key a given ciphertext was encrypted to; we can only learn this by conveying the diversifier from sender to recipient alongside the KEM ciphertext. Doing so publicly exposes part of the recipient address, severely impacting privacy; thus it must be encrypted as part of the outer protocol.

The leading candidate that was standardised is ML-KEM, a lattice-based key encapsulation mechanism. A similar protocol, Saber, was considered close in security to ML-KEM, and received similar scrutiny across the competition, but was ultimately not selected for NIST standardisation. A derivative of it, Kopis, has been specified at C2SP.

Kopis decapsulation reconstructs a public key from the secret key and binds the encapsulated key to its hash. If the public key depends on a diversifier unknown to the recipient until it decrypts an enclosing message, that procedure cannot directly validate the ciphertext. Recording every issued public key would also defeat scanning with one secret key.

Xiphos supports such scanning while retaining Kopis’s underlying PKE encryption and re-encryption structure.

Privacy Implications

An application can scan ciphertexts for multiple diversified public keys without retaining an address list. A provisional shared key is supplied to the enclosing decryption computation, but its plaintext and success or failure must not become externally visible before final validation. The security of this composition, including chosen-ciphertext behavior, has not been established; applications must not infer a post-quantum privacy claim from this draft alone.

Requirements

Specification

Constants

Define the additional domain-separation constants:

DOMSEP_DIVERSIFY = 0x51
DOMSEP_CTHASH = 0x52
DOMSEP_SHAREDSECRET = 0x53
DOMSEP_FALLBACK = 0x54

These separate diversified matrix-seed derivation, ciphertext hashing, provisional shared-secret derivation, and fallback matrix-seed derivation, respectively, from Kopis’s domain separators.

Parameters

A Xiphos instantiation selects a Kopis parameter set and an independent, fixed DIVERSIFIER_SIZE in bytes. Every byte string of that length is a permitted diversifier; Xiphos assigns it no application-specific meaning. The parameters ℓ, μ, and t and size constants SK_SIZE, PK_SIZE, and CT_SIZE are imported from the selected Kopis parameter set.

Key Generation

fn XiphosExpandSecretKey(sk: [u8; SK_SIZE]) -> (VecR13, [u8; 32], [u8; 32]):
    let expanded    = TurboSHAKE256(sk || (ℓ as u8), 96, DOMSEP_KGEXPAND)
    let mat_seed    = expanded[0..32]
    let secret_seed = expanded[32..64]
    let z           = expanded[64..96]
    let s           = GenSecret(secret_seed)
    return (s, z, mat_seed)

fn XiphosDerivePublicKey(
    s: VecR13,
    mat_seed: [u8; 32],
    d: [u8; DIVERSIFIER_SIZE]
) -> ([u8; PK_SIZE], [u8; 32]):
    let rho_d = TurboSHAKE256(mat_seed || d, 32, DOMSEP_DIVERSIFY)
    let A_d   = GenMat(rho_d)
    let b_d   = CompressToR10(transpose(A_d) * s)
    let pk_d  = serialize_vec(10, b_d) || rho_d
    let pkh_d = TurboSHAKE256(pk_d, 32, DOMSEP_PKHASH)
    return (pk_d, pkh_d)

fn XiphosSkToPk(sk: [u8; SK_SIZE], d: [u8; DIVERSIFIER_SIZE]) -> [u8; PK_SIZE]:
    let (s, _, mat_seed) = XiphosExpandSecretKey(sk)
    let (pk_d, _)       = XiphosDerivePublicKey(s, mat_seed, d)
    return pk_d

Unlike Kopis, Xiphos derives the public matrix seed from mat_seed and d rather than using mat_seed directly. The secret vector s is independent of d and is shared across the diversified public keys.

Encapsulation

fn XiphosEncap(randomness: [u8; 32], pk_d: [u8; PK_SIZE]) -> ([u8; 32], [u8; CT_SIZE]):
    let pkh_d  = TurboSHAKE256(pk_d, 32, DOMSEP_PKHASH)
    let b      = TurboSHAKE256(randomness || pkh_d, 64, DOMSEP_FO)
    let r      = b[32..64]
    let ct     = PkeEncrypt(r, pk_d, randomness)
    let cth    = TurboSHAKE256(ct, 32, DOMSEP_CTHASH)
    let k      = TurboSHAKE256(randomness || cth, 32, DOMSEP_SHAREDSECRET)
    return (k, ct)

The caller MUST sample randomness uniformly and independently for each encapsulation.

The derivation of b and r is unchanged from Kopis. The first 32 bytes of b, which Kopis uses as its shared secret, are discarded.

Decapsulation

Unlike Kopis, Xiphos must recover the diversifier before it can reconstruct the public key for re-encryption validation. It derives a provisional key bound to the ciphertext and passes it to a decrypt closure, which returns Ok((d, value)) or Err without a diversifier. Xiphos then validates the ciphertext and releases value only if both steps succeed. On closure failure, it uses z to derive fallback key-generation inputs, emulating the effect of Kopis’s implicit rejection.

Xiphos uses Kopis’s PKE decryption calculation with Xiphos secret-key expansion:

fn XiphosPkeDecrypt(sk: [u8; SK_SIZE], ct: [u8; CT_SIZE]) -> [u8; 32]:
    let (s, _, _) = XiphosExpandSecretKey(sk)
    let b_prime   = deserialize_vec(10, ct[0..256*ℓ*10/8])
    let cm        = deserialize_elem(t, ct[256*ℓ*10/8..])
    let v         = transpose(b_prime) * (s as VecR10)
    let cm10      = (cm as R10) << (10 - t)
    let m_prime   = DecodeMsg(v - cm10)
    return serialize_elem(1, m_prime)

Let T be the caller’s return type. DecryptionError and DecapsulationError each denote a single undifferentiated failure value.

fn XiphosDecap<T>(
    sk: [u8; SK_SIZE],
    ct: [u8; CT_SIZE],
    decrypt: Fn([u8; 32]) -> Result<([u8; DIVERSIFIER_SIZE], T), DecryptionError>
) -> Result<T, DecapsulationError>:
    let (s, z, mat_seed) = XiphosExpandSecretKey(sk)

    let randomness      = XiphosPkeDecrypt(sk, ct)
    let cth             = TurboSHAKE256(ct, 32, DOMSEP_CTHASH)
    let k               = TurboSHAKE256(randomness || cth, 32, DOMSEP_SHAREDSECRET)
    let dummy_mat_seed  = TurboSHAKE256(z || cth, 32, DOMSEP_FALLBACK)
    let inner           = decrypt(k)

    let (selected_mat_seed, selected_d) = match inner:
        Ok((d, _)) => (mat_seed, d)
        Err        => (dummy_mat_seed, [0u8; DIVERSIFIER_SIZE])

    let (pk_d, pkh_d) = XiphosDerivePublicKey(s, selected_mat_seed, selected_d)
    let b             = TurboSHAKE256(randomness || pkh_d, 64, DOMSEP_FO)
    let rprime        = b[32..64]
    let cprime        = PkeEncrypt(rprime, pk_d, randomness)
    let accept        = inner.is_ok() & constant_time_equal(ct, cprime)

    if accept:
        return Ok(inner.value)
    else:
        return Err(DecapsulationError)

Here inner.value denotes value from the successful closure result, not its diversifier. The closure MUST NOT expose provisional plaintext, mutate externally visible state, or otherwise reveal its result before final acceptance. Only upon a successful re-encryption check may value be exposed to the caller.

The match and final if specify selection semantics, not permission for secret-dependent branching. PKE decryption, selection of key-generation inputs, key reconstruction, re-encryption, comparison, and result selection MUST be constant-time with respect to secret inputs. The fallback derivation and re-encryption check MUST run regardless of closure success, and both operands of the final conjunction MUST be evaluated. The closure MUST likewise avoid secret-dependent timing. An ordinary branching Result implementation alone does not satisfy these requirements.

The fallback selects a 32-byte matrix seed rather than relying on the size of the diversification space to avoid the real public key.

The ciphertext hash cth MAY be cached across trials with different secret keys, but MUST be computed from the exact ciphertext supplied to PKE decryption. Secret-key expansion MAY be shared between the decapsulation function and its PKE decryption call.

The security of reusing the secret vector across diversified matrices, deriving the shared secret without the public-key hash, and deferring the re-encryption check has not been established. Xiphos does not inherit Kopis’s IND-CCA security claim. Provisional decapsulation before ciphertext validation requires chosen-ciphertext analysis.

Batch Decapsulation

XiphosDecap defines the result of one composed operation. Implementations MAY schedule multiple such operations in batches, provided each result is equivalent to that definition and the same confidentiality and constant-time requirements hold. Batching does not change the wire format or cryptographic functions.

There are three independent reuse boundaries:

To accommodate a batched enclosing protocol, an implementation MAY represent an unfinished decapsulation by an opaque internal state. The first phase binds that state to the exact secret key and candidate ciphertext and makes k available only to the enclosing decryption computation. The second phase takes that state and the corresponding closure result, selects the real or fallback key-generation inputs, and performs the remaining steps of XiphosDecap. This is a scheduling decomposition of the closure-based operation, not an independently usable KEM that returns provisional secrets.

Every closure invocation has its own completion and combined result. If several invocations share a first-phase state, one successful completion MUST NOT validate another invocation. Implementations MUST prevent pairing a closure result with the state of a different trial. Intermediate states and provisional values MUST NOT be exposed as accepted results or persisted as validated shared secrets.

Both successful and failed closure invocations MUST undergo final validation. Batch compaction, scheduling, memory accesses, and error handling MUST NOT reveal provisional success or which internal check failed. In particular, collecting only successful closure results for re-encryption is not equivalent to the specified operation. Batching MAY share identical computations or use algebraically equivalent batch operations, but MUST preserve each trial’s validation and acceptance conditions.

Security Analysis

TBD.

Rationale

Application-independent instantiation

Keeping application identifiers and address rules outside Xiphos allows the same construction to operate on arbitrary diversification strings. An application can separate pools or other contexts in its secret-key derivation without adding those concepts to Xiphos’s inputs.

The Kopis parameter set and diversification-string length are selected independently so that an application’s address format does not determine the KEM parameter set. The generic definition therefore inherits Kopis’s parameters rather than embedding the sizes of one proposed application instantiation.

Shared secret vector

Keeping the secret vector independent of the diversifier lets the recipient perform PKE decryption with one prepared secret key. Diversifying the secret vector instead would require the recipient to know which vector to use before decryption, or to try vectors for a stored list of diversifiers.

We therefore diversify the public matrix seed. This preserves Kopis’s PKE calculation, but exposes multiple public-key equations involving the same secret vector. Security analysis must cover that joint distribution rather than treating the diversified public keys as independently generated keys.

Diversified matrix-seed derivation

Hashing the matrix seed together with the diversifier produces a diversified seed of the size expected by Kopis’s unchanged matrix generator. This places diversification in the seed derivation rather than modifying matrix generation or assigning application-specific meaning to the diversifier.

Retaining Kopis encryption

Diversification does not require changing Kopis’s polynomial operations, encodings, or PKE encryption, so these remain unchanged. The encryption randomness also retains Kopis’s public-key binding: it is taken from the second half of the 64-byte expansion under DOMSEP_FO. Requesting only 32 bytes would select the first half of the XOF output, not the encryption randomness used by Kopis.

Consequently, Kopis and Xiphos produce identical ciphertexts for the same public key and encapsulation randomness, although they return different keys. A sender can use Kopis encapsulation with a Xiphos public key, so the ciphertext alone cannot identify the intended key derivation. Conversely, ordinary seed-based Kopis decapsulation reconstructs the undiversified public key and cannot be substituted for Xiphos decapsulation.

Ciphertext-bound key derivation

Retaining Kopis’s encapsulated-key derivation would create a dependency cycle: the recipient needs the public-key hash to derive the key, but needs the key to decrypt the message containing the diversifier and reconstruct that public key. Deriving the key from the recovered randomness and ciphertext instead removes that dependency. PKE encryption does not use the encapsulated key, so the sender can construct the ciphertext before deriving it.

Using only the recovered randomness would give the same key to every ciphertext that decrypts to that value. Including the entire ciphertext, through its hash, distinguishes those keys subject to the hash assumptions. It does not replace the public-key-bound re-encryption check or establish public-key commitment.

Separate ciphertext hashing

Hashing the ciphertext separately allows all recipient keys tried against that ciphertext to share the hash computation. Hashing the recovered randomness concatenated directly with the ciphertext would repeat the ciphertext hashing for every trial.

For Xiphos-768, the direct approach hashes a 1,120-byte input per trial. The chosen approach hashes the 1,088-byte ciphertext once, then a 64-byte input per trial. Unlike Kopis’s public-key hash, which can be cached for the lifetime of a key, this hash is reusable only for the same ciphertext. A single trial incurs an additional hash invocation; the expected benefit is for multiple-key scanning, and its size remains to be measured.

Domain separation

Using TurboSHAKE’s domain-separation parameter distinguishes the added operations without adding application-specific labels to their inputs. Separate suffixes distinguish matrix-seed diversification, ciphertext hashing, key derivation, and fallback derivation from each other and from Kopis’s existing hash operations.

The inherited calculations retain Kopis’s separators so that public-key hashing and encryption-randomness derivation remain unchanged. This separates hash purposes, not wire formats: it does not prevent a Kopis sender from encapsulating to a Xiphos public key.

Closure-based decapsulation

In an FO-based KEM with implicit rejection, such as Kopis, decapsulation returns a key rather than a ciphertext-validity signal. In a composition with authenticated encryption, the caller learns whether decryption succeeded when it applies that key to the authenticated ciphertext. Similarly, an ECDH-derived key does not itself indicate whether it will decrypt a particular authenticated ciphertext. The composed decryption has one rejection point, and plaintext is not released before authentication succeeds.

Diversification reverses the order of the relevant checks: the inner decryption recovers the diversifier needed to perform the KEM’s re-encryption check. Taking that decryption as a closure allows Xiphos to preserve a single rejection point despite the reordered computations. The final acceptance condition combines the closure result with the re-encryption result, so plaintext is released only after both checks succeed. A failed closure remains a failure even if re-encryption with fallback inputs happens to match.

Implicit rejection or a closure interface alone does not guarantee constant-time execution. Timing and externally visible side effects could still disclose an intermediate result. The execution constraints therefore apply to the enclosing decryption as well as the KEM calculations.

Fallback matrix seed

A failed inner decryption does not provide a diversifier. Returning at that point would skip public-key reconstruction and re-encryption, giving the failure path a different computational structure. Xiphos instead supplies fallback inputs and completes those calculations.

Substituting only a diversifier would make the fallback’s separation from the real key depend on the diversification space. An application may use a short diversifier; for example, an 11-byte diversifier provides only an 88-bit space. Deriving a 32-byte matrix seed from z and the ciphertext hash avoids that dependency. The zero diversifier then serves only as a fixed input to the normal public-key derivation, not as a source of fallback entropy.

Using Kopis’s secret expansion value z with the ciphertext hash gives a secret, ciphertext-specific fallback. This adapts Kopis’s rejection mechanism to the point where diversification leaves the public-key derivation inputs unavailable: the substitute is an internal matrix seed rather than a returned rejection key.

Intermediate states for batch decapsulation

A scalar closure interface is not necessarily the most efficient way to schedule trials across several ciphertexts and recipient keys. An opaque intermediate state is a suggested implementation technique for allowing the inner decryption stages to be batched without directly returning unverified key material as a usable KEM result. It is not a required interface; the concrete batch API remains unsettled.

The purpose of any such decomposition is to preserve the scalar operation’s plaintext-release boundary. Diversification changes the order in which the ciphertext checks can occur, but batching should not release plaintext until all checks for that trial have completed successfully. Intermediate state can keep those pending checks associated with the corresponding trial while allowing shared preparation and batched computation.

Reference implementation

No reference implementation is claimed by this draft. The underlying Kopis algorithms are linked in 2. Xiphos needs independent test vectors and security review for diversified keys and composed decapsulation.

Open issues

References