Naor-Pinkas Oblivious Transfer (OT) #
This file formalizes the Naor-Pinkas (2001) DDH-based 1-out-of-2 OT protocol and proves both sender security (information-theoretic) and receiver security (DDH-based).
Protocol #
The receiver holds a choice bit σ ∈ {0,1}. The sender holds messages m₀, m₁ ∈ G.
Receiver: Sample
a, b, cfromExp. Send(g^a, g^b, z₀, z₁)wherez_σ = g^{ab}(DDH triple) andz_{1-σ} = g^c(random).Sender: For each
i ∈ {0,1}, sample(sᵢ, rᵢ), computewᵢ = g^{a·sᵢ + rᵢ}andeᵢ = g^{dᵢ·sᵢ + b·rᵢ} · mᵢwheredᵢis the exponent ofzᵢ.Receiver: Decrypt
m_σusings_σ, r_σ(the DDH position is decryptable).
Security #
Sender security: When d ≠ ab (non-DDH position), the map
(s, r) ↦ (as + r, ds + br) is a bijection on Exp × Exp, so (wᵢ, eᵢ)
is uniformly distributed and the message is information-theoretically hidden
(otEnc_message_independent). The honest receiver samples c uniformly, so
c = ab occurs with probability 1 / |Exp|; ot_sender_secure bounds the
real/ideal advantage by that probability.
Receiver security: The receiver's public values (g^a, g^b, z₀, z₁) contain
a DDH triple at the choice position. Distinguishing σ=0 from σ=1 reduces to DDH.
References #
- Naor & Pinkas, "Efficient Oblivious Transfer Protocols", SODA 2001
- EasyCrypt: beschmi/oblivious_transfer
- CryptHOL: Multi_Party_Computation AFP entry
CyclicGroupRing: Exponent Ring Structure #
The sender security proof requires the matrix map (s,r) ↦ (as+r, ds+br) to be
a bijection when d ≠ ab. This needs ring structure on exponents (addition,
multiplication, distributivity) beyond what CyclicGroup provides.
Extension of CyclicGroup with ring structure on exponents.
The key new operations are expAdd (addition in Z_q) and the distributivity
law expMul a (expAdd b c) = expAdd (expMul a b) (expMul a c).
The crucial expMul_bij ensures multiplication by a nonzero element is bijective.
- gen : G
- mul : G → G → G
- inv : G → G
- one : G
- expAdd : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G → CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G → CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G
Addition of exponents
Zero exponent
- pow_add (a b : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G) : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.pow (expAdd a b) = CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.mul (CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.pow a) (CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.pow b)
g^(a+b) = g^a · g^b - pow_zero : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.pow expZero = CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.one
g^0 = 1 - expAdd_comm (a b : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G) : expAdd a b = expAdd b a
Addition is commutative
- expAdd_assoc (a b c : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G) : expAdd (expAdd a b) c = expAdd a (expAdd b c)
Addition is associative
Right identity for addition
- expAdd_neg (a : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G) : expAdd a (CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expNeg a) = expZero
Additive inverse:
a + (-a) = 0 - expMul_comm' (a b : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G) : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expMul a b = CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expMul b a
Multiplication is commutative
- expMul_add (a b c : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G) : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expMul a (expAdd b c) = expAdd (CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expMul a b) (CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expMul a c)
Left distributivity:
a(b+c) = ab + ac - expMul_assoc (a b c : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G) : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expMul (CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expMul a b) c = CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expMul a (CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expMul b c)
Multiplication is associative
- expMul_bij (d : CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.Exp G) : d ≠ expZero → Function.Bijective (CatCryptCore.Examples.CyclicGroupDDH.CyclicGroup.expMul d)
Multiplication by nonzero is bijective (prime-order group)
Instances
Subtraction of exponents: a - b := a + (-b)
Equations
Instances For
Left identity for addition: 0 + a = a
g^(-a) = (g^a)⁻¹
Additive right cancellation: a + c = b + c → a = b
Additive left cancellation: c + a = c + b → a = b
Right distributivity: (a+b)c = ac + bc
0 · a = 0
a · 0 = 0
a · (-b) = -(a · b)
(-a) · b = -(a · b)
expSub a a = 0
Recovering from sub: expAdd (expSub a b) b = a
Protocol Definitions #
Sender encryption for one position.
Given exponents (a, b, d) corresponding to (x = g^a, y = g^b, z = g^d),
encrypt message m by sampling (s, r) and computing:
w = g^{as + r}(mask for receiver)e = g^{ds + br} · m(encrypted message)
When d = ab (DDH position), the receiver who knows s can compute g^{ds+br}
and decrypt. When d ≠ ab, the pair (w, e) is uniform — m is hidden.
Equations
- One or more equations did not get rendered due to their size.
Instances For
OT transcript: public keys + two ciphertexts
Instances For
Real OT game: both messages are encrypted normally (no adversary substitution).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Ideal OT game: the non-chosen message is replaced by the identity.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The Naor-Pinkas encryption step otEnc does not read or write the heap.
The real OT game ot_real does not read or write the heap.
The ideal OT game ot_ideal does not read or write the heap.
Matrix Bijection #
The key algebraic fact for sender security: the linear map
M(s, r) = (as + r, ds + br) on Exp × Exp is a bijection when d - ab ≠ 0.
The matrix map (s, r) ↦ (as + r, ds + br) on exponents.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The matrix map is injective when d - ab ≠ 0.
The matrix map is bijective when d - ab ≠ 0.
Sender Security #
The key theorem: when d ≠ ab, the encryption otEnc a b d m produces a
distribution independent of m. This is because the matrix map
(s,r) ↦ (as+r, ds+br) is a bijection, so (w, e) is uniformly distributed.
Translation equivalence on exponents: s ↦ s + c.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Key lemma: otEnc a b d m0 = otEnc a b d m1 when d - ab ≠ 0.
The proof uses a translation coupling. When d - ab ≠ 0, we can find a constant
shift δ such that coupling s₀ ↔ s₀ + δ and r₀ ↔ r₀ - aδ preserves the
first output component g^{as+r} and exactly compensates the message change
in the second component g^{ds+br} · m.
c ≠ d implies c - d ≠ 0 on exponents.
Sampling a uniform x and continuing with f x or with g x gives an advantage
of at most 1 / |α| against every distinguisher, when f and g agree at every
point except x₀.
Sender security of Naor–Pinkas OT, statistical form.
For every distinguisher A and every choice bit sigma, the real transcript (both
messages encrypted) and the ideal transcript (the unchosen message replaced by the
identity) are at advantage at most 1 / |Exp|. The two games coincide on every
receiver sample with c ≠ a·b (otEnc_message_independent); the term 1 / |Exp|
is the probability of the event c = a·b, on which the unchosen position is a DDH
triple and its message is decryptable.
Receiver Security #
The receiver's public values (g^a, g^b, z₀, z₁) encode the choice bit σ:
position σ has a DDH triple (g^a, g^b, g^{ab}), the other has a random g^c.
Distinguishing σ=0 from σ=1 reduces to DDH via a standard hybrid argument.
Receiver's view: what the sender sees (the public commitment).
Equations
- One or more equations did not get rendered due to their size.
Instances For
DDH reduction for receiver security.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Bridge lemma: monad pure equals SPComp.pure for simp matching.
The reduction with real DDH matches the receiver's view.
When DDH is ideal (z random), both σ values give the same distribution.
Receiver security: the advantage of distinguishing σ=0 from σ=1 is bounded by the sum of two DDH advantages.