Repository navigation
Computational Security
For format revision 7, QKD is not required to obtain strong computational secrecy of derived keys from a securely shared, uniformly random 32-byte PSK. This is a conditional claim about key derivation. It does not establish information-theoretic security, forward secrecy, or security of the entire server implementation. QKD and this PSK design offer different guarantees; this design assumes the initial secret has already been distributed securely.
The implementation is in src/keys.rs; the exact byte layout and formulas are
in Encrypted key IDs. Writing
Separate labels derive the AES-256 ID-encryption key and the one-byte ID
checksum. Here
The argument assumes:
- The PSK is uniformly sampled from 256 bits, independent of attacker inputs, securely provisioned, and never disclosed. A 32-byte password does not qualify.
- HKDF-Extract with this fixed public salt and this random PSK produces a computationally pseudorandom PRK. This is an explicit extraction assumption, not a consequence of HMAC being a PRF under a secret key: here the salt is the public HMAC key and the PSK is its message. The 512-bit PRK does not create 512 bits of entropy from a 256-bit seed.
- Under a uniform secret PRK, HKDF-Expand-SHA512 is jointly pseudorandom across
the three distinct labels and their permitted inputs, including adaptively
chosen inputs. Repeated
infoyields the same stream; shorter requests are prefixes, not independent outputs. This is the HKDF expansion assumption, motivated by the PRF security of HMAC-SHA-512. - Endpoints and their random generators are uncompromised; TLS authenticates peers and protects key responses; default SAE authorization is correctly configured. The attacker cannot obtain the target key through an authorized recipient, API access, logs, memory disclosure, or a side channel.
RFC 5869 specifies HKDF. Krawczyk's HKDF analysis develops its extraction and pseudorandomness foundations. These references support the building block; they do not certify this service or remove the explicit assumptions above.
Consider a computationally bounded classical attacker who sees public IDs,
knows the algorithm, and can learn keys for other IDs, including through its
own authorized SAE. It selects a valid target ID
Let
- In each experiment, replace the extracted PRK by a uniform 64-byte secret.
Each replacement changes the attacker's output probability by at most
$\varepsilon_{\mathrm{extract}}$ . - Replace the expansion interface by an independent random byte stream for
each distinct
info, with consistent repeated queries and prefixes. Each replacement costs at most$\varepsilon_{\mathrm{expand}}$ . The AES-key label, checksum label, and key-material label have disjoint encodings. - In this final hybrid, ID generation uses only the independent AES-key and checksum streams. It can still encrypt, reject non-v4 ciphertexts, decrypt, and check authorization exactly as before. Even though real IDs depend on the PSK, their generation in this hybrid never consults the target key-material stream. Adaptive selection of an unexposed ID therefore leaves its key stream uniform and independent of the visible transcript.
- The real-key and random-key experiments in the final hybrid have identical distributions. Apply the triangle inequality across both sets of replacements to obtain the bound above.
This is a reduction-style proof sketch under stated assumptions, not a machine-checked proof or a numerical security bound for SHA-512. AES security is needed for the separate metadata-hiding claim, not to keep the final hybrid's independently sampled key stream secret. Metadata hiding additionally requires a pseudorandom-permutation assumption for AES-256 and its own leakage analysis; this key-secrecy proof does not establish it.
An attacker need not recover a SHA-512 preimage to win: it could distinguish HKDF output, guess the PSK, exploit key delivery, or compromise a recipient. Preimage resistance alone does not imply pseudorandomness of derived keys. Nor does finding a SHA collision generally reveal the PSK or a derived key.
Exhaustive search over a uniform PSK has a space of
-
No forward secrecy or fresh shared entropy. PSK compromise exposes past and future keys for available IDs under that PSK. All stubs sharing it belong to the same compromise domain. Replacing it makes old IDs unusable with the new configuration; it does not protect old keys from a leaked old PSK.
-
ID collisions and replay. For a fixed SAE pair and key length, UUID filtering leaves about
$2^{66}$ accepted IDs under the AES permutation model. For$q$ independent issuances in that group, the birthday approximation is$$ \Pr[\text{repeat}] \approx \frac{q(q-1)}{2^{67}} $$
while the probability is small. Repeats become significant around
$2^{33}$ issuances. Sum the group bounds when tracking many pairs or lengths. A repeat gives the same key, so a previously disclosed repeat cannot be a fresh challenge in the proof. This is a key-reuse limit, not a$2^{66}$ PSK search space. The service does not track collisions, expire IDs, consume keys, or prevent replay; applications must manage key/nonce reuse. -
No issuance authentication. The 8-bit checksum is an error check, not a MAC. AES encryption and format checks do not prove that an ID was issued. Validation responses are not covered by an integrity or metadata-secrecy theorem here. SAE checks control retrieval of the target ID; they do not turn this format into authenticated encryption.
-
API access matters. Whoever the server authorizes can obtain the key for a valid ID without knowing the PSK. That is intended for the ID's SAE pair, but any weakening of SAE authorization violates the target-key non-disclosure assumption. Incorrect certificate validation, leaked credentials, or a compromised authorized SAE also bypass the cryptographic problem.
-
Computational, not information-theoretic. Deterministically expanding a shared PSK creates no additional shared secret entropy. These outputs do not provide information-theoretic one-time-pad security. The project remains an integration-test stub; this argument is not a production security audit.
The following options are design ideas, not implemented features or additional guarantees of revision 7. The current service has a permanent PSK, no epoch state, and repeat retrieval of old IDs.
Forward secrecy protects past keys against later compromise of the current secret, once the secrets needed to recover those keys have been erased. Post-compromise security restores future secrecy after an attacker loses access and new secret material is introduced. “Backward secrecy” has varying meanings, so this discussion uses the latter term explicitly. See RFC 9420, security considerations and the Double Ratchet specification for these distinctions.
| Possible approach | Fits no direct KME-to-KME communication? | Protection |
|---|---|---|
| Deterministic one-way secret ratchet | Yes, with a shared epoch rule and persistent state | Protects erased past epochs; does not recover from compromise of current state |
| Fresh independent PSKs provisioned to both KMEs | Yes, if external secure provisioning is allowed | Protects erased past epochs and restores future secrecy after secure replacement and removal of attacker access |
| Interactive authenticated key-agreement ratchet | Requires an exchange, possibly relayed by clients | Can support both properties under the selected protocol's assumptions |
Relaying a key-agreement exchange removes a direct network connection, but it is still logical KME-to-KME communication. Secure external provisioning also introduces coordination outside the two services. Neither should be described as operating solely from the original shared PSK.
A possible epoch ratchet derives an epoch's key material and the next epoch's secret using separate KDF labels. Both KMEs can perform the same deterministic evolution independently. Protecting earlier epochs requires deleting their secrets, the initial PSK, and any retained material from which they can be reconstructed, including recoverable backups. A later compromise of either KME exposes whatever that KME still retains; cached application keys remain outside the protection provided by deleting KME state.
This requires durable state, crash recovery and rollback protection. Keeping the initial PSK for restart recovery would defeat the intended protection. It also changes the current promise that old IDs remain retrievable indefinitely.
Both KMEs could derive their current epoch from a common time schedule. This requires approximately synchronized clocks, with an explicit allowance for drift and delayed requests. Retaining previous epoch secrets for an overlap window supports retries but delays their erasure and thus their protection. An offline KME or restored backup may still contain old secrets; a schedule alone does not prove that both copies have been erased.
Alternatively, a future key-ID format could carry an epoch counter. The issuing KME chooses the epoch according to an agreed advancement policy; the receiving KME advances its ratchet when the client presents an ID for a later epoch. This avoids a shared clock and a direct KME connection, but the client-carried ID provides indirect coordination. Independent issuance at both KMEs also requires a policy for requests from a peer that is behind.
The counter must be available before selecting the epoch key and must be cryptographically bound to the ID. The current encrypted UUID format and 8-bit checksum do not supply this mechanism. A design must authenticate a request before committing destructive advancement, bound the work needed to handle a proposed counter jump, and reject rollback. Merely trusting a larger counter could allow forged requests to erase usable state or exhaust resources.
After advancement, deleting old secrets makes delayed requests for those epochs fail. Retaining them supports retries but weakens the erasure guarantee. A KME that receives no further requests may retain old secrets indefinitely. Thus a counter avoids clock synchronization, but cannot by itself ensure timely erasure at both independent KMEs or confirm that a peer has finished an epoch.
If an attacker copies all current shared secret state, deterministic updates and public inputs cannot restore secrecy: the attacker can reproduce them. Post-compromise recovery requires new shared secret material unknown to that attacker, supplied through secure provisioning or an appropriate authenticated exchange after access is lost. Encrypting a replacement PSK only under the compromised PSK is insufficient.
With no KME exchange and no new provisioning, a one-way ratchet can therefore protect erased past epochs, but cannot provide automatic post-compromise recovery. Indefinite reconstruction of old keys from current KME state is also incompatible with protecting those keys against compromise of that same state. A future implementation must choose an advancement policy and a bounded retrieval/retention window before claiming forward secrecy.