Documentation

CslibFrontier.Crypto.Computational.KeyExchange.KeyGuessing

Key-guessing security for anonymous key exchange #

[BS23], Section 10.1 (Attack Game 10.1 and Definition 10.1, p. 400), defines key-guessing security for an anonymous (unauthenticated) two-party key-exchange protocol: after an honest execution outputs its public transcript and key, a PPT adversary given the transcript tries to output the exact shared key. Section 10.4.2 (p. 408) states that Diffie–Hellman key exchange satisfies this notion if and only if the Computational Diffie–Hellman assumption holds.

In Section 10.1 (pp. 399–400) Alice and Bob are probabilistic machines whose transcript is a function of their random bits. PrimeOrderGroupFamily.dhKeyExchangeProb runs dhExecutionProb, in which Alice and Bob sample their exponents with PrimeOrderGroupFamily.sampleExp (certified uniform strict PPT in isPPTOn_dhExecutionProb and correct in dhKeyExchangeProb_correct, within statistical distance 1 / 2 ^ n of uniform on ZMod q per party). Its anonKEGame is within 2 / 2 ^ n of cdhGame (advantage_anonKEGame_dhKeyExchangeProb_cdhGame_le), yielding the faithful equivalence dhKeyExchangeProb_anonKESecure_iff_cdh from the exact-uniform step dhKeyExchange_anonKESecure_iff_cdh_ideal.

Main definitions #

Main results #

Ideal-sampling steps #

Implementation notes #

References #

@[reducible, inline]

A key-guessing adversary against an anonymous key-exchange protocol ([BS23], Section 10.1, Attack Game 10.1, p. 400): given the security parameter and the public transcript t, it outputs a candidate key in K t.

def Cslib.Crypto.KeyExchange.KeyGuesser.IsPPT {T : Type} {K : T → Type} (encT : T ↪ List Bool) (encK : (t : T) → K t ↪ List Bool) (adversary : KeyGuesser T K) :

A key-guessing adversary is PPT when one uniform strict PPT machine reads (1ⁿ, transcript) encoded by encPair encUnary encT and writes encK transcript guess.

noncomputable def Cslib.Crypto.KeyExchange.anonKEGame {T : Type} {K : T → Type} [(t : T) → DecidableEq (K t)] (protocol : KeyExchange T K) (adversary : KeyGuesser T K) (n : ℕ) :

The key-guessing game ([BS23], Section 10.1, Attack Game 10.1, p. 400): run the honest protocol execution, hand outcome.transcript to adversary, and accept when its guess equals outcome.aliceKey. For Correct protocols this equals checking outcome.bobKey (Correct.anonKEGame_eq_bobKey).

def Cslib.Crypto.KeyExchange.AnonKESecure {T : Type} {K : T → Type} [(t : T) → DecidableEq (K t)] (protocol : KeyExchange T K) (encT : T ↪ List Bool) (encK : (t : T) → K t ↪ List Bool) :

Key-guessing security for anonymous key exchange ([BS23], Section 10.1, Definition 10.1, p. 400): every PPT key-guessing adversary guesses the session key with negligible probability in anonKEGame.

The book builds correctness into protocols, whereas KeyExchange.Correct is unbundled here, so the book's notion corresponds to protocol.Correct ∧ protocol.AnonKESecure encT encK. Called "secure against an eavesdropper" in Boneh–Shoup; distinct from KeyExchange.EavSecure, which is the Katz–Lindell real-versus-ideal indistinguishability notion (it gives key-guessing security only when the ideal key is hard to guess, and no implication is proved here).

theorem Cslib.Crypto.KeyExchange.Correct.anonKEGame_eq_bobKey {T : Type} {K : T → Type} [(t : T) → DecidableEq (K t)] {protocol : KeyExchange T K} (hcorr : protocol.Correct) (adversary : KeyGuesser T K) (n : ℕ) :
protocol.anonKEGame adversary n = Game.withSetup (protocol.execute n) fun (outcome : Outcome T K) => do let guess ← adversary n outcome.transcript pure (decide (guess = outcome.bobKey))

For a correct key-exchange protocol, winning anonKEGame (matching Alice's key) has the same law as matching Bob's key.

View a Diffie–Hellman key-guessing adversary as a CDH adversary over F ([BS23], Section 10.4.2, pp. 407–408).

View a CDH adversary over F as a Diffie–Hellman key-guessing adversary ([BS23], Section 10.4.2, pp. 407–408).

Running anonKEGame on F.dhKeyExchange setup with adversary gives the exact same game as running F.cdhGame setup with F.dhToCDHAdversary adversary ([BS23], Section 10.4.2, pp. 407–408).

theorem Cslib.Crypto.PrimeOrderGroupFamily.cdhGame_eq_anonKEGame_dhKeyExchange (F : PrimeOrderGroupFamily) (setup : ℕ → PMF F.Desc) (adversary : F.CDHAdversary) (n : ℕ) :
F.cdhGame setup adversary n = (F.dhKeyExchange setup).anonKEGame (F.cdhToDHKeyGuesser adversary) n

Running F.cdhGame setup with adversary gives the exact same game as running anonKEGame on F.dhKeyExchange setup with F.cdhToDHKeyGuesser adversary ([BS23], Section 10.4.2, p. 408).

Ideal-sampling step toward [BS23], Section 10.4.2, p. 408, not the cited result: dhKeyExchange setup, whose parties draw their exponents exactly uniformly on ZMod q at the PMF level rather than as probabilistic machines on random bits (Section 10.1, pp. 399–400), is key-guessing secure (AnonKESecure, Definition 10.1) if and only if CDH holds for setup. Consumed by dhKeyExchangeProb_anonKESecure_iff_cdh, which proves the equivalence for the fair-coin protocol dhKeyExchangeProb.

The key-guessing game anonKEGame against the fair-coin Diffie–Hellman protocol dhKeyExchangeProb and the CDH game cdhGame on dhToCDHAdversary adversary differ in success probability by at most 2 / 2 ^ n (1 / 2 ^ n for each party's sampleExp draw). Because dhToCDHAdversary (cdhToDHKeyGuesser B) = B is definitional, instantiating adversary with cdhToDHKeyGuesser B gives the same 2 / 2 ^ n bound in the converse direction.

Diffie–Hellman anonymous key exchange is key-guessing secure if and only if CDH holds ([BS23], Section 10.4.2, p. 408, with Attack Game 10.1 and Definition 10.1, Section 10.1, p. 400, and Attack Game 10.5 and Definition 10.7, Section 10.5, pp. 409–410): the fair-coin protocol dhKeyExchangeProb setup, whose parties sample their exponents with sampleExp (isPPTOn_dhExecutionProb, dhKeyExchangeProb_correct), satisfies AnonKESecure against uniform strict PPT key guessers if and only if F.CDH setup holds. Derived from dhKeyExchange_anonKESecure_iff_cdh_ideal and advantage_bind_dhKeyExchangeProb_le with sampling loss at most 2 / 2 ^ n.