One attractive solution is to use a bulletproofs range proof.
Note:All the math in this answer assumes
- prime order finite field with generator
G
(EG:ed25519)
- Capital letters are group elements (EG:
P
,Q
)
- lowercase letters are scalars. (EG:
s
,t
)
- Additive notation.
The date of birth is represented as a Unix timestamp x
or similar. Negative numbers are fine, all arithmetic will be done modulo the field order and so negative integers wrap around past zero to become large positive integers. Given a required age a
(integer seconds) and a current date today
(Unix timestamp) to prove a person is at least that old, just prove their birthday x
is less than or equal to the Unix timestamp today-a
.
This integer x
is hidden using a Pedersen commitment. A commitment C
for an integer x
is a group element of a prime order group (usually an elliptic curve) in which discrete log is hard. It uses two publicly known generators H
and G
of a prime order group and a secret blinding integer r
.
C = x*G+r*H
The identity document D
would contain such a commitment rather than a numeric age.
Using homomorphism to transform inequalities
Pedersen commitments are homomorphic and can be added together with other commitments or with non-hidden values of the form V=v*G
. Multiples of G
can be added or subtracted from the commitment as shown below.
C
= C + V = (xG+rH) + v*G = (x+v)G+rH`
The range proof allows proving that the value inside a commitment x
is in the range 0
≤x
<2^n
. Typically n
is 64
although scaling to 128 bits has little additional cost.
We can transform statements of the form x≥a
to (x-a)≥0
by adding a multiple of G
to the commitment using the additive homomorphism of the commitment. Assuming (x-a)<2^64
for the largest possible x
, this can be proven using a 64 bit range proof. For x<a
we do (x+2^n-a)<2^n
using the upper bound of the range proof.
Privacy concerns and after-the-fact deniability
All solutions proposed so far (including this one) leave permanent proofs that the number meets some bound. Peggy might not want a such a proof to be floating around forever.
It's possible to make an existing public coin zero knowledge proof like a bulletproof deniable in a number of ways, that all do roughly the same thing. The challenges in a public coin proof need to be unpredictable to the prover. So make them malleable in some way. Either have Victor choose and commit to them before the protocol starts so he and Peggy can collude to forge a proof making transcripts worthless or add a trapdoor to the Fiat-Shamir transform to allow roughly the same thing for non-interactive proofs (Sigma OR designated verifier proofs, Short lived proofs).
All of these are practically challenging since you’d need to modify the bulletproofs library. Not fun.
Fortunately there’s a more modular option that doesn’t require messing with the bulletproofs directly. We add a point P=r*H
, representing a Pedersen commitment to 0
to the existing commitment C
to obtain C'=C+P
, then prove knowledge of r
to Victor using some deniable proof. We can then use the commitment C'
in a non-deniable proof as described earlier. This proof is worthless without knowing the commitment P
opens to zero though.
To prove knowledge of r
in an online protocol, just do a Diffie-Hellman key agreement with Victor, using H
as the generator with victor choosing some multiple of H
as an ephemeral key. Otherwise, given Victor’s public key Y
, a solution to the following system of equations is persuasive:
R1=Hash(P|R2)*P+s1*H
R2=Hash(Y|R1)*Y+s2*G
Peggy does:
R1=H*k
for a random k
R2=Hash(Y|R1)*Y+s2*G
for a random s2
s1=k - r*Hash(P|R2)
- sends
(P,R1,R2,s1,s2)
to Victor
The equations can use entirely different groups. Victor could have a P-256 public key and the commitment could be in the ed25519 curve field as an example.
Knowing the discrete log of P
or Y
in the relevant base H
or G
allows that equation to be solved for a chosen R1
or R2
. The two equations are cross coupled so a solution to the system can be found by knowing either of the relevant discrete logs.
Peggy can, optionally, use s2
as a private Diffie-Hellman key and send Victor the resulting shared secret s2*Y
or some bits of its hash. Victor’s private key is then needed to verify the proof by computing the expected value making it unverifiable by third parties and trivial to forge with victor's key.
V
permitted to know enough information to forge aD
with any particular age? (This would imply thatV
is not allowed to knowP
's actual date of birth, but is permitted to know howP
would answer ifP
was any arbitrary age) – Cort Ammon Jun 01 '17 at 19:35D
is signed using elliptic curve signature it's possible to prove a signature exists without revealing it. This might solve a number of problems since now there's no lasting proof that the revealed identity document is legitimate. – Richard Thiessen May 09 '23 at 04:42