Repository navigation
Description
Summary
Nice to have, not planned. This issue records an idea, and the reasoning behind it, so it isn't lost. Pick it up only when a concrete user or use case needs it. Until then it stays deferred.
The idea is threshold file encryption: encrypt a file, or any data of any size, so that any t + 1 of n trustees can open it together and no group of t or fewer can. It would reuse the threshold key and the verified decryption shares from ADR-0053, which merged in #76.
Background: why the existing ElGamal can't do this
ADR-0052's elgamal-jubjub-v1 is exponential ElGamal. A message m is encrypted as [m]·G, and decryption has to search for m with baby-step giant-step. That only works for small numbers. These measurements come from docs/benchmarks/elgamal-jubjub-2026-10-05.md:
| Value bound | Roughly | Decryption search (worst case) |
|---|---|---|
| 2^32 | 4.3 billion | ~20 ms |
| 2^40 | 1.1 trillion (≈ 1.1M ADA in lovelace) | ~0.8–0.9 s |
| 2^43 (default caps) | ≈ 8.8M ADA in lovelace | seconds |
Encrypting is allowed up to 2^64, but decrypting above about 2^43 is impractical with the defaults. A 128-bit file key is therefore out of reach, and so is a file. Counts, scores, bids and tallies are what this ElGamal is for.
For comparison, single-recipient encryption of data of any size is covered by HPKE (RFC 9180), which ADR-0054 (#77) introduces. What is missing is the threshold case: "any 3 of 5 can open this".
Likely construction (needs its own ADR, R3)
Hybrid encryption with a threshold KEM:
- Encrypt the file with a random symmetric key
K, using an AEAD such as ChaCha20-Poly1305. - Derive
Kfrom a Diffie–Hellman value with the committee's joint keyy. PublishA = [r]·G, and deriveKfrom[r]·y. - To open, each trustee publishes a verified decryption share. This is the same
D_j = [x_j]·Awith a DLEQ proof that ADR-0053 already produces. - Any
t + 1shares combine by Lagrange interpolation to[x]·A = [r]·y, which givesK, which decrypts the file.
Security reference. Plain threshold hashed ElGamal is only CPA-secure. The standard design that also resists chosen-ciphertext attacks in the threshold setting is TDH2: V. Shoup and R. Gennaro, Securing Threshold Cryptosystems against Chosen Ciphertext Attack, EUROCRYPT 1998. The ADR must pin the construction, the KDF and AEAD, the context and label binding, and the share-verification rules. This issue proposes none of them, and per AGENTS.md no cryptography is to be invented here.
On-chain footprint. Files live off-chain, for example on IPFS or S3; a Cardano transaction is at most about 16 KB. On-chain there is only a small header:
- the encapsulation
A(plus TDH2's proof elements); - the file hash or content identifier;
- the binding data, such as session, label and release policy.
Decryption shares, and the decision to release, can be posted on-chain, so the release is auditable.
Why it is "nice to have", not a priority
- No ZK, and little chain involvement. General-purpose file encryption is already covered by existing tools: age, PGP, Shamir-based key splitting, and threshold key-management services. On its own it is not a reason for ZeroJ to build this.
- A large security surface for niche demand. It needs a pinned scheme, a careful binding design and an external review.
- Better-aligned work comes first: ADR-0054: encrypted DKG share delivery (HPKE RFC 9180) — resolve ADR-0053 Q1 #77 (DKG share delivery) and ADR-0055: confidential notes on Jubjub — DH opening delivery + optional in-circuit consistency proof (twisted ElGamal deferred) #79 (confidential notes) serve use cases we already demonstrate, such as private voting and confidential points.
Where it would add real value over existing tools
It earns its place when on-chain rules decide when the data opens, and trustee misbehaviour must be detectable. Each share is DLEQ-verified, so a cheating trustee is caught.
- Sealed tenders with full documents, not just bid amounts. They open only after the on-chain deadline, by a quorum.
- Escrow or dispute evidence. Evidence is posted encrypted, and an arbitration panel (for example 3 of 5) can open it only if a dispute is raised on-chain.
- Embargoed governance material, such as proposals or audit reports, released when a vote closes or a quorum agrees.
- Inheritance or a dead-man switch. Keys or instructions are released when the owner stops checking in and the executors agree.
Sketch of milestones (if picked up)
| ID | Scope |
|---|---|
| M0 | ADR with pinned TDH2 (or an alternative), threat model, binding, invariants. A normative spec plus an independent reference implementation with vectors. |
| M1 | Threshold KEM on top of ADR-0053's ThresholdKeyContext and verified shares. KDF and AEAD from JDK primitives, as in ADR-0054. |
| M2 | File envelope format (off-chain body plus on-chain header), with negative and adversarial tests: wrong label, forged shares, mixed ciphertexts, too few shares. |
| M3 | Example use case, such as a sealed tender on Yaci DevKit, plus docs. |
Open questions for the ADR
- TDH2 or another CCA-secure threshold KEM? Which hash, KDF and AEAD?
- Labels and context: what binds a ciphertext to its release policy (deadline, script, session)?
- Should release be enforced only by trustee behaviour, or should an on-chain validator gate the posting of shares?
- Key lifetime: one DKG per sealed item, or a long-lived committee key?
- Maturity: experimental, offline class (ADR-0039), with an external audit before any production claim.
Dependencies
- ADR-0053 (threshold DKG and verified decryption shares), merged in feat(elgamal): ADR-0052 ElGamal on Jubjub + ADR-0053 threshold DKG — accepted designs and implementation #76.
- ADR-0054 / ADR-0054: encrypted DKG share delivery (HPKE RFC 9180) — resolve ADR-0053 Q1 #77: DKG share delivery over the chain (design in PR feat(dkg): ADR-0054 encrypted DKG share delivery with HPKE (accepted design and implementation) #80).
- Related: ADR-0055: confidential notes on Jubjub — DH opening delivery + optional in-circuit consistency proof (twisted ElGamal deferred) #79 (confidential notes). It also delivers secrets on-chain, but to designated readers, not to a quorum.
Activity