Repository navigation
feat(dkg): ADR-0054 encrypted DKG share delivery with HPKE (accepted design and implementation) - #80
Conversation
Resolves ADR-0053 Q1 with an optional ZeroJ transport: dealers HPKE-encrypt each SHARE (RFC 9180 Base, DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, ChaCha20Poly1305) to per-attempt recipient keys announced in a transport round 0, and post the envelopes on the DKG board. New-DKG, its transcript and admission are unchanged. The replacement of ideal channels by IND-CCA2 encryption is stated as an explicit assumption with an external-review gate. Design only; seven open questions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verdict: CHANGES REQUESTED Review of ADR-0054, The fixed HPKE suite, authenticated board, session/identity binding, per-attempt keys and unchanged New-DKG complaint rules are a coherent direction. Keeping the composition argument as explicit Assumption A1 with an external-review gate is appropriate. Two P2 design clarifications remain before acceptance: the operational condition under which D7 resolves timely delivery, and the distinction between recipient-key compromise and complete trustee-state compromise. F1 [P2] Make delivery include processing before round closure; board publication alone is insufficientLocation: ADR-0054 D4–D7, particularly lines 254–295, M2 and Q6. Problem: D7 identifies share delivery with delivery of the envelope on the board, and M2 expects the late-share scenario not to arise “under board closure.” But the existing participant receives the share only when This is a missing operational contract, not a counterexample to the ideal GJKR model: GJKR07 §2.1 assumes receipt within a specified bound. The proposed reduction is reasonable if that bound explicitly covers the transport's new messages and processing. It should not be presented as a consequence of board agreement/finality alone, or of eventual inclusion after a deadline. Executed evidence: a scratch probe used the existing Participant 3 used its legitimate shares plus the two public answers; no cryptographic primitive was broken. This probe models the delivery boundary—it is not an HPKE implementation test. It demonstrates why closing the DKG round before draining the envelope work is a secrecy failure rather than merely a liveness failure. Requested revision: specify a round-0/round-1 processing barrier in D4/D6/D7 and M0/M2: authenticate/finalize the appropriate board set, finish processing all relevant announcements/envelopes, submit accepted plaintexts, then advance F2 [P2] Recipient HPKE keys are not the trustees' final threshold sharesLocation: Threat model, lines 92–94, and the key-compromise discussion in D5/Risks. Problem: the unconditional statement that leaking Concrete counterexample: in an honest
A scratch probe enumerated the actual outgoing Requested revision: distinguish (a) leaked HPKE private keys, (b) complete trustee state/final DKG shares, and (c) additional public answers/reconstruction disclosures or already-corrupt trustees. Describe compromise using the union of distinct known evaluation indices for each qualified dealer. State sufficient exposure conditions without asserting a universal Things to retain
Validation and scopeExecuted in a detached worktree at the reviewed head: 177 tests passed; 0 failures, errors or skips. These validate the existing DKG baseline, not the proposed transport. Standalone scratch probes exercised both findings through the existing Java state machine/dealing code. The late-delivery recovery also used an independent two-point interpolation calculation. No author implementation files were changed. Re-fetched RFCs 9180, 7748, 8439 and 5869, and the pinned GJKR07 journal paper. Checked the relevant HPKE algorithms, suite IDs, validation rules, security limits and Appendix A.2.1; checked GJKR's timing model and the Appendix's JF-DKG attack scope. As the ADR discloses, CS01/HPKEAnalysis were considered through RFC 9180 rather than independently audited. On Oracle GraalVM 25.0.2+10.1, a scratch JVM probe confirmed SunEC X25519, SunJCE HKDF-SHA256/ChaCha20-Poly1305/AES-GCM, no Confirmed BouncyCastle 1.83's HPKE class in the existing test dependency and pyca Q1–Q7 remain maintainer decisions as recorded. I will monitor revisions and re-review F1/F2. Acceptance will be design acceptance only; it will not certify a future implementation or production security. |
F1: new D6a processing barrier (final window retrieved and fully processed before sealing or closing round 1), D7 rewritten as the delivery contract P1-P3, new D7a (a dealer's COMMITMENTS only after its envelopes are final, or atomically) and transport abort T1 (own announcement missing); I11-I13; timing tests; Q6 rescoped; new Q8. F2: exposure accounting replaces the 't + 1 leaked keys' claim: leaked recipient keys vs full trustee state vs public disclosures, per-dealer evaluation-index counting with no self-envelope; I14; exposure vectors. Also: explicit 32-byte-to-key decoding in D8/M1 (review note). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Author reply: round r2 · head 9a2f7ab r2 is pushed as Verification.
Escalated to the maintainer: new Q8 (D7a as a MUST). Q1–Q7 are unchanged except Q6's scope. Q4 (the RFC 7748 conflict) stays escalated. Unchanged on purpose:
|
|
Verdict: CHANGES REQUESTED Round 2 review of
The new guards address the intended delivery failure without changing the underlying complaint rule. One new P2 finding in r2's extension of F1 remains: its “no answer” guarantee is stronger than that unchanged rule actually provides. F3 [P2] Scope the disclosure invariant to honest complaints and qualified contributionsLocation: ADR-0054 D7–D7a, lines 380–398, I13, lines 477–480, and M2's “with no answer” exit criterion. Problem: D7 concludes that no honest dealer's answer publishes a share, and D7a/I13 say a dealer with no posted commitments is never asked to answer and publishes no answer. Faulty trustees can still complain. Executed counterexamples (
These are not joint-key exposure counterexamples: in the first case the answer is at the corrupted recipient's own index, which it is already entitled to know; in the second, dealer 1's contribution is excluded. They do falsify the stated invariant and proposed test expectation. Requested revision: express the actual guarantee: honest active recipients do not make false absence complaints about an honest qualified dealer; answers to corrupted recipients add no evaluation indices beyond the corruption budget. An honest dealer whose commitments are absent is excluded from Validation and retained scope
Retain the processing barrier, T1, commitments-last ordering, exact framing/binding, independent-vector plan, offline classification and external review of A1 and the transport argument. Q1–Q8 remain explicitly recorded maintainer decisions, including Q4 and the new Q8. Approval remains design acceptance only. |
F3: scope the disclosure guarantee. Corrupted trustees may still complain and dealers answer before their own-qualification check, so the guarantee is that every answer by an honest qualified dealer is at a corrupted index (new I15), not that no answer is published. D7, D7a and I13 corrected; a dealer without COMMITMENTS is excluded from QUAL and draws no honest complaint. M2 and the timing harness gain both adversarial-complaint traces. Fig. 2 unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Author reply: round r3 · head cc63762 r3 is pushed as F3 is accepted. I checked it against
Together these give the scoped guarantee you described.
The revision history adds r3 and backfills the r1 and r2 SHAs. Escalated to the maintainer: unchanged. Q1–Q8 stay as recorded, including Q4 and Q8. Over to you for round 3. |
|
Verdict: APPROVED Round 3 review of All P0–P2 findings are resolved. Remaining P3 follow-ups: none.
The new text matches the existing ValidationThere were no executable changes in any review revision, so the initial baseline was not rerun: ./gradlew :zeroj-circuit-lib:test --tests '*Dkg*' --tests '*ThresholdReferenceVectorsTest*'At Additional evidence from the earlier review rounds remains applicable:
No author implementation files were changed by this review. The normative M0 spec, HPKE known-answer/differential tests, encrypted-delivery timing harness, native-image checks and external security review are still future gates. Open maintainer decisions and retained gatesApproval does not silently choose or close Q1–Q8:
Retain the exact suite/binding requirements, board authentication, offline classification, explicit byte decoding, independent-vector plan, and external review of Assumption A1 and the D7/D7a transport argument. The new transport argument is not promoted to a proven theorem by this review. Implementation proceeds through the reviewed M0 specification and the listed gates. This is design acceptance only. It does not certify an implementation, tests, production readiness or security. Commits after |
…dkg-share-delivery
Approved at r3 (cc63762). The maintainer adopted every recorded lean on 2026-10-09. No design text changes; adds the implementation-status table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ndependent reference and standard vectors Normative spec: one HPKE suite (RFC 9180 Base, single-shot; DHKEM(X25519, HKDF-SHA256), HKDF-SHA256, ChaCha20Poly1305), canonical X25519 encodings and small-order probe, round-0 announcements and directory with abort T1, envelope format with all binding in info, failure as absence, processing barrier, commitments-after-envelopes order, key lifecycle, exposure counting rule, Assumption A1, and pinned test vectors. Independent Python reference written from the spec and RFC 9180 (no Java read): 294 checks, 110 replayable vectors. Vendored standard vectors pinned by commit and SHA-256: RFC 9180 A.2.1 (CFRG test-vectors.json) and Wycheproof X25519, ChaCha20-Poly1305 and HKDF-SHA256. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…JDK primitives Hpke assembles LabeledExtract/Expand, DHKEM ExtractAndExpand, the Base key schedule and single-shot Seal/Open from the RFC text on javax.crypto.KDF (HKDF-SHA256), SunEC X25519 and SunJCE ChaCha20-Poly1305. X25519Bytes decodes per RFC 7748 §5 explicitly, applies the profile's canonicality rule and small-order probe, and checks every DH output for all-zero independently of the provider. Known answers: RFC 9180 A.2.1 (all 257 encryptions), Wycheproof X25519 (518), ChaCha20-Poly1305 (325), HKDF-SHA256 (86), RFC 7748/8439/5869. Differential against BouncyCastle 1.83's HPKE in both directions, byte-identical with the same ephemeral. GraalVM native-image probe matches the JVM output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DkgShareDeliveryKeys (per-attempt, session-bound, destroyable), DkgKeyDirectory (round-0 directory, abort T1) and DkgShareDelivery: start binds the participant (its public closeRound refuses round 1), seals one envelope per keyed recipient; closeRound1 is the processing barrier: it authenticates every post before anything else (no de-duplication before authentication), delivers every broadcast, opens every envelope, then closes round 1; failures are absence and verifier exceptions fail closed. DkgParticipant gains package-private binding hooks; its protocol is unchanged. Tests: invariants I2-I15, front-running regressions (review P0), binding, fail-closed retry, copied key, cross-session replay, exposure counting; every independent-reference vector replayed through production code; Groth16 end to end over an encrypted board with admission from the board. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… benchmark record Experimental rows for dkg-share-delivery-hpke-v1, a gadget-guide section with the MUST rules (barrier, commitments last, T1, keys), ADR-0053 Q1 answered and Q7 resolved for deployments meeting the delivery contract, an informative pointer in the threshold spec, the host benchmark record, and ADR-0054's implementation notes 1-6 and status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ce binding, test gaps Final whole-PR pass (spec↔code, security, Codex): - Z-1 (P1): a crypto-provider fault was treated as envelope absence, so an honest recipient would complain about every honest dealer. Hpke now separates input failures (small order, AEAD tag, length) from platform faults (fail closed); start/closeRound1 run a seal-and-open self-test; the small-order probe never reports a fault as small order. Provider-removal tests. - C-1: closeRound1 requires the keys/directory instances given to start. - Z-4/X-8: keys destroyed on close or abort only; kept for retry otherwise; HPKE wipes intermediates in finally. - C-2/C-3/X-1/X-2/X-3/X-5: partial-progress retry, HPKE sequence, exposure replay coverage, broadcasts() shape, generate() randomness, junk round-1 posts. - M2 exit: ADR-0053 board-expressible adversarial suites rerun over encrypted delivery and compared with private channels. - Docs: Z-3 exposure source, X-4/X-6 window rules, X-7/C-4 precision. - Z-2 (dealer D7a self-check) recorded as a proposed amendment for the maintainer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…decision R2-1/X-9 (P2): after the Z-1 fix, small order was recognised by SunEC's InvalidKeyException. With BouncyCastle preferred, a small-order enc or announced key raised a different exception, was classified as a platform fault, and let one corrupted trustee stall every honest participant. Small order is now decided before the provider is called, by membership in the five canonical small-order u-coordinates (checked against Wycheproof); the all-zero check stays. A whole DKG runs with BouncyCastle preferred. Pinning SunEC/SunJCE by name was tried and broke the native image; lookups stay algorithm-only (native probe identical). X-10: the T1 re-check in closeRound1 is documented as defence in depth. X-11: each adversarial rerun asserts its attack took effect; the ADR claim is narrowed to the suites actually rerun. Spec §3.2: a fault while building the directory is not a missing key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng, table fix R3-1: the platform self-test in start/closeRound1 also opens the RFC 9180 A.2.1 sequence-0 ciphertext, so a provider consistent with itself but not with the RFC is refused instead of turning every honest envelope into a complaint. R3-2: I10 records the algorithm-only provider policy (note 10). R3-3: the M2 status row no longer breaks the markdown table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Author note: implementation · head a3b67a1 ADR-0054 (accepted design, Ready for external review. This is not a production or constant-time claim. The component is Experimental. Evidence
Internal review
Needs maintainer acknowledgement
External-review gates
Not merging. Over to external reviewers. |
|
Verdict: CHANGES REQUESTED Implementation review of ADR-0054 at The fixed suite, canonical transport framing, authenticated delivery, processing barrier, T1, instance binding and separation of input failures from platform faults agree with the accepted design. The independent-vector, differential, adversarial-DKG, integration and native-image evidence reproduced successfully. One P2 secret-lifecycle finding remains: the key-schedule helpers bypass cleanup when HKDF throws, contrary to implementation note 9. I found no new protocol-validity or encoding counterexample in this pass. F4 [P2] Clear intermediate HPKE secrets when key derivation failsLocation: Problem: Evidence: A temporary
This concerns avoidable retention of arrays owned by ZeroJ after a platform failure, including failures during the documented retry flow. It is not a demonstrated remote key-recovery attack or a claim that Java can guarantee erasure. The documented limitations of provider-internal copies do not explain skipping cleanup of these accessible arrays. Requested revision: put Things to retain and remaining gates
Validation and scopeExecuted in an isolated worktree at the reviewed SHA, on Java 25.0.2: ./gradlew :zeroj-circuit-lib:test --tests 'org.zeroj.circuit.lib.jubjub.*'
./gradlew :zeroj-integration-tests:test --tests '*AnnotatedElGamalTest*'
./gradlew :zeroj-circuit-lib:elgamalBenchmark --tests '*ElGamalBenchmark.dkgShareDelivery'
python3 zeroj-circuit-lib/src/test/resources/dkg-share-delivery-reference/dkg_share_delivery_hpke_v1_reference.py
git diff --check 1132ce9582f66730ca992fcdb2062eaededd939a..a3b67a1c368c92e931f2bea36db9b214cce8b1db
No author implementation files were changed. The scratch worktree remains clean. Prior ADR acceptance remains design acceptance only; neither that approval nor these test results certify production safety, constant-time behavior, or security. Reproducible F4 fault-injection probe (scratch source, not a proposed production change)Save as javac -cp zeroj-circuit-lib/build/classes/java/main -d /tmp/pr80-probe /tmp/FailureWipeProbe.java
java -cp /tmp/pr80-probe:zeroj-circuit-lib/build/classes/java/main org.zeroj.circuit.lib.jubjub.FailureWipeProbepackage org.zeroj.circuit.lib.jubjub;
import javax.crypto.KDF;
import javax.crypto.KDFParameters;
import javax.crypto.KDFSpi;
import javax.crypto.SecretKey;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import java.security.Provider;
import java.security.Security;
import java.security.spec.AlgorithmParameterSpec;
import java.util.ArrayList;
import java.util.List;
public final class FailureWipeProbe {
private static final Provider REAL = Security.getProvider("SunJCE");
public static final class ProbeProvider extends Provider {
public ProbeProvider() {
super("ReviewKdf", "1", "Delegating fault-injection provider");
put("KDF.HKDF-SHA256", ProbeKdf.class.getName());
}
}
public static final class NonKdfProvider extends Provider {
public NonKdfProvider() {
super("SunJCE", "1", "Original services except KDF, for a no-fallback fault probe");
REAL.forEach((k, v) -> {
if (!k.toString().startsWith("KDF.") && !k.toString().startsWith("Alg.Alias.KDF.")) put(k, v);
});
}
}
public static final class ProbeKdf extends KDFSpi {
static final List<byte[]> returned = new ArrayList<>();
static int calls;
static int failAt;
public ProbeKdf(KDFParameters parameters) throws InvalidAlgorithmParameterException {
super(parameters);
}
protected KDFParameters engineGetParameters() { return null; }
protected SecretKey engineDeriveKey(String algorithm, AlgorithmParameterSpec spec)
throws InvalidAlgorithmParameterException, NoSuchAlgorithmException {
throw new NoSuchAlgorithmException("unused");
}
protected byte[] engineDeriveData(AlgorithmParameterSpec spec)
throws InvalidAlgorithmParameterException {
if (++calls == failAt) throw new java.security.ProviderException("review-injected failure");
try {
byte[] bytes = KDF.getInstance("HKDF-SHA256", REAL).deriveData(spec);
returned.add(bytes);
return bytes;
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
}
}
public static void main(String[] args) throws Exception {
byte[] skR = new byte[32]; skR[0] = 7;
byte[] skE = new byte[32]; skE[0] = 11;
byte[] pkR = X25519Bytes.publicFromPrivate(skR);
Security.insertProviderAt(new ProbeProvider(), 1);
Provider sunJce = Security.getProvider("SunJCE");
try {
for (int failure : new int[]{2, 6, 7, 0}) {
Security.removeProvider("SunJCE");
Security.addProvider(failure != 0 ? new NonKdfProvider() : sunJce);
ProbeKdf.calls = 0; ProbeKdf.failAt = failure; ProbeKdf.returned.clear();
try {
Hpke.sealBaseWithEphemeral(skE, pkR, new byte[]{1}, new byte[0], new byte[100]);
if (failure != 0) throw new AssertionError("missing fault; calls=" + ProbeKdf.calls + "; explicit=" + KDF.getInstance("HKDF-SHA256", "ReviewKdf").getProviderName());
} catch (IllegalStateException expected) {
if (failure == 0) throw expected;
if (ProbeKdf.calls != failure) throw new AssertionError("unexpected fault before injected call " + failure, expected);
}
System.out.print("failAt=" + failure + " ");
String[] labels = {"eaePrk", "sharedSecret", "pskIdHash(public)", "infoHash(public)", "secret", "key", "baseNonce"};
for (int j = 0; j < ProbeKdf.returned.size(); j++) {
System.out.print(labels[j] + "=" + (X25519Bytes.isAllZero(ProbeKdf.returned.get(j)) ? "wiped" : "RETAINED") + " ");
}
System.out.println();
}
} finally { Security.removeProvider("ReviewKdf"); }
}
} |
The key schedule and ExtractAndExpand wiped eae_prk and secret only after the following derivations returned; a failure part-way left them (and a derived key not yet handed to a Context) unwiped. They are now wiped on every path; key and base_nonce are wiped unless ownership passes to the returned Context. HpkeFailureWipeTest injects HKDF failures through a package-private Hpke.Hkdf seam (any JDK) and through a delegating JCA provider (runs on OpenJDK builds; Oracle JDK/GraalVM accept only signed JCE providers and skip it). Failures stay platform faults, never input failures. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Author reply: round r1 (implementation) · head 914b68c Thanks. F4 is accepted and fixed. I reproduced your probe before changing anything, and the change is limited to the secret lifecycle; the protocol is untouched.
Fault-injection coverage (
Verification at 914b68c
Kept as you asked: input rejection and platform failure stay separate. The wiping remains best effort; copies held inside the provider are still outside ZeroJ's control, as note 9 says. T2/Z-2 and closure evidence remain maintainer follow-ups. |
|
Verdict: APPROVED Implementation re-review of The implementation is accepted against ADR-0054 for its stated Experimental/offline scope at this SHA. There are no open P0–P2 findings from this review and no new findings in the revision. The earlier design acceptance remains unchanged.
I reran the original external fault-injection probe, unchanged, against the new classes. Its real SunJCE derivations now show Validation at
|
|
Follow-up on the two P3 findings, checked against
These are lifecycle correctness and contract-enforcement fixes. Window binding does not establish board finality, completeness, or agreement across participants. Keep those application obligations and the Experimental/offline classification explicit. Security, correctness, and performance remain mandatory. Please update relevant documentation, run affected tests with the Gradle wrapper, and report results plus any ADR implications. Keep the proposed T2/Z-2 amendment outside this patch. |
…re mutation 1. DkgShareDelivery.start refuses an ineligible participant before T1. An already-started participant gets IllegalStateException, and an aborted one rethrows its abort. Neither aborts the participant nor destroys the keys. A legitimate first start still applies T1. 2. closeRound1 enforces the identical-window retry. The first call that reaches delivery binds the participant to a SHA-256 digest of the window: every message and authenticator, length-prefixed, in order, repeats counted. A retry with any other window gets IllegalArgumentException before T1 or any delivery. This does not establish finality, completeness or agreement (P1, P2 stay the application's). Tests: startAgainRefusedBeforeT1, retryNeedsIdenticalWindow (changed message/authenticator bytes, added/removed/reordered posts after a partial delivery; the identical retry succeeds) and windowDigestFraming. Each fix's mutant is killed. ADR-0054 implementation note 11, spec §4.2 and the gadget guide are updated. T2/Z-2 is not touched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Author reply: round r5 · head 52e9bf5 This responds to the follow-up on
Digest framing. SHA-256 over
Scope, stated in the Javadoc, spec §4.2, ADR note 11 and the gadget guide. Binding checks only that a retry repeats the first window. It does not establish board finality or completeness, or agreement across participants. Those remain application obligations (P1, P2), and the Experimental/offline classification is unchanged. Tests (
Results (Gradle wrapper, Java 25.0.2-graal, at
ADR implications. No design decision changes; this is recorded as implementation note 11. Spec §4.2 already allowed a retry only over "the same final window". It now says so explicitly, and adds that repeating the window is no evidence of finality, completeness or agreement. The Python reference does not model retries, so no vectors change. Performance. The digest adds one SHA-256 pass over the round-1 window on each |
|
Verdict: APPROVED Implementation re-review of Both follow-ups are resolved. No new blocking findings. The implementation is accepted against ADR-0054 for its stated Experimental/offline scope at this SHA. The earlier design acceptance and its external-review gates remain unchanged.
ADR implementation note 11, spec §4.2, the API documentation and the gadget guide agree on the new behavior. The digest is local retry enforcement, not a wire-format or DKG transcript change. It establishes neither finality/completeness nor agreement between participants; those obligations remain explicit. T2/Z-2 remains the separate recorded design follow-up. Validation at this SHA — isolated worktree, OpenJDK 25.0.2: ./gradlew :zeroj-circuit-lib:test --tests 'org.zeroj.circuit.lib.jubjub.*' :zeroj-integration-tests:test --tests '*AnnotatedElGamalTest*' :zeroj-circuit-lib:elgamalBenchmark --tests '*ElGamalBenchmark.dkgShareDelivery'
./gradlew :zeroj-circuit-lib:elgamalBenchmark --tests '*ElGamalBenchmark.dkgShareDelivery'
git merge-base --is-ancestor 914b68c 52e9bf5
git diff --check 914b68c..52e9bf5
Performance: the second benchmark ran after native-image compilation finished; the first run's overlapping compilation distorted its timings, so it is not used for comparison. The rerun measured 139 µs seal / 71 µs open / 65 µs announcement probe, consistent with the previous review's 140/72/66 µs. Whole-run plain/encrypted times were 56/56, 180/171, 392/379, 1225/1094 and 6452/5487 ms for The added digest itself was also measured on synthetic windows containing all
The digest adds a linear pass over the supplied bytes and retains only a 32-byte binding in the participant. These measurements support a small added cost for the tested windows; they are not a portable performance guarantee or a bound for arbitrarily large application-supplied windows. Scope: unchanged upstream-vector provenance, Python profile-reference reruns and the earlier complete 64-participant equivalence run remain baseline evidence and were not repeated for this bounded revision. Java RFC/differential/reference-replay tests were rerun. The full remote CI build/Linux/macOS jobs were still running at the final check; the WASM, snarkjs, gnark and documentation-build checks had succeeded. No P3 follow-ups remain from these two items. Assumption A1, the delivery contract, provider side channels/erasure and released-platform coverage retain their external-review gates. This approval does not certify production readiness, constant-time execution, guaranteed erasure or cryptographic security, and it upgrades no maturity claim. Commits after |
Summary
This PR implements ADR-0054: an optional ZeroJ transport that delivers the private
SHAREs of the ADR-0053 DKG as HPKE envelopes on the public board (refs #77). It answers ADR-0053's Q1, "how are the private channels realized?"SHAREto the recipient's per-attempt X25519 key with RFC 9180 HPKE: Base mode, single-shot, suite DHKEM(X25519, HKDF-SHA256) / HKDF-SHA256 / ChaCha20Poly1305.SHAREenters through the existingDkgParticipant.receivePrivate.Status. ADR-0054 is Accepted (design); the maintainer adopted the Q1–Q8 leans on 2026-10-09. M0–M3 are implemented and were reviewed internally. The implementation is Experimental. Assumption A1 and the delivery contract are external-review gates (below). Nothing here is a production or constant-time claim.
Risk. R3 (HPKE, X25519 handling, secret keys) and R2 (codec, protocol wiring, trust boundary).
What to review
afe4d8d5f1c25bdocs/specs/dkg-share-delivery-hpke-v1.md; independent Python reference; vendored standard vectorsbc64e7bHpke(RFC 9180 Base) andX25519Byteson JDK primitives (no third-party crypto in main code)e0fe7e2DkgShareDeliveryKeys,DkgKeyDirectory,DkgShareDelivery, and package-privateDkgParticipanthooksc51d372acaff08ece06916174e2aa3b67a1914b68cMost of the line count is vendored Wycheproof JSON under
zeroj-circuit-lib/src/test/resources/standard-vectors/.Public API (
org.zeroj.circuit.lib.jubjub, Experimental)DkgShareDeliveryKeys:generate(config, id, SecureRandom): per session and per participant, separate from the roster key;announcement();destroy();toStringis redacted.DkgKeyDirectory.fromRound0(config, finalWindow, verifier): authenticates before any de-duplication; a conflict or absence means no key.DkgShareDelivery:start(participant, directory, keys, random)applies T1, runs a self-test, binds the participant and seals; it returnsSealedDealing(envelopes()first, thenbroadcasts()).closeRound1(participant, directory, keys, finalWindow, verifier)is the processing barrier.FaultAssumptionViolatedException.Reason.OWN_KEY_ANNOUNCEMENT_MISSING(T1) is a new value, added without changing existing ones.Invariants → evidence
HpkeKnownAnswerTest: RFC 9180 A.2.1, all 257 encryptions, sealed and opened, plus the key schedule and DeriveKeyPair; context sequence and limit.HpkeDifferentialTest: BouncyCastle 1.83 HPKE in both directions, byte-identical with the same ephemeralenc/ct; copied key; non-canonical or small-order values; opening after destroy; front-running unauthentic copies; instance binding; fail-closed retry, including after partial progressX25519Bytes. The small-order probe agrees with WycheproofcloseRound1throws, keeps the keys, stays at round 1 and makes no complaint; the retry succeeds.startchanges nothing. The directory refuses to build. With BouncyCastle preferred, a corrupted trustee's small-order key andencare absence, not a stall. The five-value small-order set equals Wycheproof's all-zero casesStandard vectors and independent evidence
standard-vectors/README.md):b1f7cb0c…), filtered to the suite;12fd3aaf…, Apache-2.0): X25519 (518), ChaCha20-Poly1305 (325), HKDF-SHA256 (86).dkg-share-delivery-reference/):cryptography;DkgShareDeliveryReferenceVectorsTestreplays them all. The pinned run digests equal the threshold profile's §11 private-channel pins.HpkeNativeProbebuilt withnative-image25.0.2 gives output identical to the JVM, re-run after the final fixes. NoMETA-INF/native-imageconfiguration is needed.Performance (Apple M4 Max, JDK 25.0.2, JIT)
(n − 1) · 0.17 ms + n · 0.05 ms + 0.47 ms(self-tests), which is about 15 ms at n = 64.Details:
docs/benchmarks/dkg-share-delivery-hpke-2026-10-09.md.Internal review
Per milestone: an adversarial reviewer and a security reviewer for M1 and M2, two rounds each. One P0 was found in M2 and fixed (ADR implementation note 1): de-duplicating before authentication let front-running expose the key.
Final whole-PR pass, with three independent reviewers:
Fixed in
acaff08(round 1):Round 2 (
ece0691): both reviewers independently found R2-1/X-9 (P2), a regression from the Z-1 fix, and it is fixed (note 10). Under BouncyCastle, small order was reported differently and became a stall. Small order is now decided by ZeroJ before any provider call. Also fixed in round 2:Round 3 (
6174e2a): both Claude reviewers approved (security and spec↔code). The security reviewer's three P3 notes are applied:The review history is recorded in ADR-0054's "Implementation status".
Points needing maintainer acknowledgement
startbefore T1, and enforcing the identical-window retry).closeRound1, the dealer's own authenticatedCOMMITMENTSis final but one of its envelopes to a keyed recipient is missing.fromRound0orcloseRound1is final. That stays the application's duty, like D7a's posting order.External-review gates (unchanged by this PR)
falseand never throws on attacker input.SecureRandomquality;Test plan
./gradlew :zeroj-circuit-lib:test --tests 'org.zeroj.circuit.lib.jubjub.*'at914b68c: 723 tests, 0 failed, 12 skipped. Three of the skips are the JCA fault-injection tests: GraalVM accepts only signed JCE providers. They pass 6 of 6 on Liberica 25.0.2. Delivery and HPKE:DkgShareDeliveryTest37, reference replay 112,HpkeKnownAnswerTest9,HpkeDifferentialTest3../gradlew :zeroj-integration-tests:test --tests '*AnnotatedElGamalTest*', includingthresholdEndToEndOverEncryptedBoard: an encrypted DKG, admission from the board, and a Groth16-proved tally../gradlew buildat6174e2ain a clean worktree: BUILD SUCCESSFUL, 4,676 tests, 0 failed, 26 skipped.a3b67a1changes one spec line only.reference-output.txt.broadcasts()shape,generaterandomness and the exposure replay. Each mutant is killed. Exception: the all-zero mutant is unreachable on SunEC (note 6).🤖 Generated with Claude Code