Kanav's Personal Page

Security Proofs #1: Motivation and Preliminaries

Introduction

You might already know what encryption, digital signatures, or homomorphic encryption do. But what does it mean to say that one of these constructions is secure? Secure against whom? What counts as a successful attack? And how can we prove something about attacks nobody has thought of yet?

A security proof starts by making those questions precise. We specify what an attacker can do and what it means for the attacker to win. Then we show that an attacker who wins too often would give us an algorithm for a problem we assume is hard.

That last step is called a reduction, and it is the main idea of this post. Before we get there, we will review the logic that makes the argument work. We will finish with a small proof about Diffie–Hellman key exchange.

You only need basic algebra to follow most of the post. The Diffie–Hellman example also uses modular exponentiation, which we will introduce as we go.

Logic Concepts

Statements and implications

A statement is an assertion that is either true or false. A theorem is a statement proved from stated assumptions and definitions. For example, “every even integer is divisible by two” is a true statement; “every integer is even” is false.

For two statements PP and QQ, the implication

P  ⟹  QP \implies Q

means “if PP is true, then QQ is true.” We call PP a sufficient condition for QQ, and QQ a necessary condition for PP.

An implication is false only when PP is true and QQ is false. When PP is false, the implication places no restriction on QQ.

For example, for an integer nn,

4∣n  ⟹  2∣n,4 \mid n \implies 2 \mid n,

where a∣na \mid n means “aa divides nn.” Every multiple of four is even. But the converse, 2∣n  ⟹  4∣n2 \mid n \implies 4 \mid n, is false: take n=6n=6.

This distinction matters in cryptography. Showing that one particular attack breaks a scheme does not show that every attack must work that way.

Contrapositives

The symbol ¬P\neg P means “not PP.” The contrapositive of P  ⟹  QP \implies Q is

¬Q  ⟹  ¬P.\neg Q \implies \neg P.

These two implications are logically equivalent. If PP guarantees QQ, then QQ being false rules out PP being true.

Tomato photo.
Existence of tomato implies existence of tomato sauce

In our divisibility example, the contrapositive says that if nn is not even, then it is not divisible by four. This follows from the original statement; the converse does not.

Security proofs use this equivalence constantly. We want to prove

a problem is hard  ⟹  a scheme is secure.\text{a problem is hard} \implies \text{a scheme is secure}.

We often do so by proving the contrapositive:

the scheme can be broken  ⟹  the problem can be solved.\text{the scheme can be broken} \implies \text{the problem can be solved}.

The second statement gives us something concrete to build: an algorithm that turns an attack into a solver.

Double implications

The statement P  ⟺  QP \iff Q, read “PP if and only if QQ,” means that both P  ⟹  QP \implies Q and Q  ⟹  PQ \implies P hold. To prove it, we must prove both directions.

For example, an integer nn is even if and only if there exists an integer kk such that n=2kn=2k. This is a characterization of evenness, rather than just a sufficient condition for it.

Similarly, claiming that two computational problems are equivalent requires reductions in both directions. One reduction alone does not establish equivalence.

Quantifiers and their order

A predicate is a statement with a variable, such as P(x)P(x): “xx is even.” A quantifier tells us which values of the variable the assertion covers:

For example, ∀x∈Z, x2≥0\forall x \in \mathbb{Z},\ x^2 \geq 0 is true, as is ∃x∈Z, x2=4\exists x \in \mathbb{Z},\ x^2=4. Here Z\mathbb{Z} is the set of integers.

The order of quantifiers matters. Compare

∀x∈Z, ∃y∈Z, y>x\forall x \in \mathbb{Z},\ \exists y \in \mathbb{Z},\ y>x

with

∃y∈Z, ∀x∈Z, y>x.\exists y \in \mathbb{Z},\ \forall x \in \mathbb{Z},\ y>x.

The first is true: after seeing xx, choose y=x+1y=x+1. The second is false: no single integer is larger than every integer. In the first statement, yy may depend on xx; in the second, one yy must work for all xx.

This is why security definitions say things like “for every efficient attacker.” Defeating one attacker we chose in advance is a much weaker claim.

Negating quantified statements

To negate a quantified statement, flip the quantifier and negate the predicate:

¬(∀x∈S, P(x))  ⟺  ∃x∈S, ¬P(x),\neg\bigl(\forall x \in S,\ P(x)\bigr) \iff \exists x \in S,\ \neg P(x),

¬(∃x∈S, P(x))  ⟺  ∀x∈S, ¬P(x).\neg\bigl(\exists x \in S,\ P(x)\bigr) \iff \forall x \in S,\ \neg P(x).

“Not every integer is even” means that some integer is not even. It does not mean that no integer is even. One counterexample disproves a universal claim.

With nested quantifiers, apply the rule at every level:

¬(∀x ∃y, P(x,y))  ⟺  ∃x ∀y, ¬P(x,y).\neg\bigl(\forall x\,\exists y,\ P(x,y)\bigr) \iff \exists x\,\forall y,\ \neg P(x,y).

Two other useful rules are De Morgan's laws:

¬(P∧Q)  ⟺  (¬P∨¬Q),¬(P∨Q)  ⟺  (¬P∧¬Q),\neg(P \land Q) \iff (\neg P \lor \neg Q), \qquad \neg(P \lor Q) \iff (\neg P \land \neg Q),

where ∧\land means “and” and ∨\lor means “or.” Also, negating an implication gives ¬(P  ⟹  Q)  ⟺  P∧¬Q\neg(P \implies Q) \iff P \land \neg Q: a counterexample must satisfy the hypothesis and violate the conclusion.

Reductions

Which way does a reduction go?

We say that problem AA reduces to problem BB if we can solve AA using a solver for BB. We write

A≤B.A \leq B.

Here we mean an efficient reduction that may call the solver as a subroutine. Other settings use more specific reduction notions, so the symbol alone does not tell the whole story.

The reduction is itself an algorithm. It receives an instance of AA, uses a solver for BB, and turns the result into a solution to its original instance. The useful way to read the notation is: a solver for the problem on the right helps solve the problem on the left.

Consequently,

B is easy  ⟹  A is easy.B\text{ is easy} \implies A\text{ is easy}.

Taking the contrapositive gives

A is hard  ⟹  B is hard.A\text{ is hard} \implies B\text{ is hard}.

So BB is at least as hard as AA, in the sense captured by the reduction. The two arrows can feel backwards at first: algorithms transfer from right to left, while hardness transfers from left to right.

Turning an attacker into a solver

In a security proof, AA is usually a computational problem, and BB is the task of breaking a particular security property of a construction. The goal is to show

A≤breaking the construction.A \leq \text{breaking the construction}.

We assume we have an attacker A\mathcal{A} and construct a solver R\mathcal{R} that uses it. Typically, R\mathcal{R} embeds its hard-problem instance into an interaction with A\mathcal{A}, answers the attacker's allowed queries, and extracts a solution from its output.

We must justify three things:

  1. The attacker's view: the interaction has the distribution required by the security definition, or is sufficiently close in a precisely justified sense.
  2. Success: the attacker's success gives the solver a solution with a useful probability.
  3. Efficiency: the solver runs efficiently whenever the attacker does.

We do not need to implement the hypothetical attacker or know how it works. We need to show how to use any attacker satisfying the assumed success guarantee.

The resulting guarantee is conditional: the reduction does not prove that AA is hard. It proves that a successful attack would also defeat our hardness assumption.

Proving the reverse direction would not establish security: an algorithm that breaks a construction using a solver for a hard problem only demonstrates one way to attack it. There could be easier attacks.

What do “efficient” and “hard” mean?

An algorithm can always try every possible key in a finite key space. Security therefore cannot mean that success is mathematically impossible.

In the usual asymptotic treatment, a security parameter λ\lambda controls the sizes of keys and other parameters. An efficient algorithm is a probabilistic polynomial-time algorithm: its running time is bounded by a polynomial in λ\lambda, and it may use randomness.

A function ν(λ)\nu(\lambda) is negligible if, for every positive integer cc, there is a threshold NN such that

λ≥N  ⟹  ν(λ)<1λc.\lambda \geq N \implies \nu(\lambda)<\frac{1}{\lambda^c}.

For example, 2−λ2^{-\lambda} is negligible, while 1/λ1/\lambda is not. “Negligible” describes how a function shrinks as the parameter grows; it does not simply mean a small number at one chosen parameter.

For a search problem, a typical hardness assumption says that every efficient algorithm has negligible probability of finding a valid solution on a randomly sampled instance. This is an average-case claim about a specified distribution, rather than a claim that every individual instance is difficult.

For the key-recovery property below, security has the same form: every efficient attacker recovers the secret only with negligible probability. Its negation is that there exists an efficient attacker whose success probability is not negligible. For other properties, such as distinguishing an encrypted bit, we instead measure the attacker's advantage over guessing.

A reduction must preserve enough success probability to make that argument work. If it turns an attack with non-negligible success into a solver with only negligible success, there is no contradiction to the hardness assumption. This is why we track probabilities as well as running time.

A Worked Example: Diffie–Hellman

The protocol and the property

Alice and Bob want to agree on a shared secret while an eavesdropper watches their messages. Let G=⟨g⟩G=\langle g\rangle be a cyclic group of prime order qq, with public generator gg. This means that the elements of GG are the powers of gg, with exponents taken modulo qq. We assume group operations are efficient.

For a concrete picture, we could use a subgroup of the nonzero integers modulo a prime pp. Then the powers below are computed modulo pp. We will use group notation so that the argument does not depend on that particular representation.

The exchange works as follows:

  1. Alice samples aa uniformly from Zq={0,…,q−1}\mathbb{Z}_q=\{0,\ldots,q-1\} and sends X=gaX=g^a.
  2. Bob independently samples bb uniformly from Zq\mathbb{Z}_q and sends Y=gbY=g^b.
  3. Alice computes YaY^a, and Bob computes XbX^b.

They obtain the same value because

Ya=(gb)a=gab=(ga)b=Xb.Y^a=(g^b)^a=g^{ab}=(g^a)^b=X^b.

Call this shared group element KK. The equality proves correctness: honest participants agree. It does not yet prove secrecy.

We will prove one specific property: a passive eavesdropper, given the public parameters and transcript (X,Y)(X,Y), cannot efficiently recover the entire value KK with non-negligible probability. The eavesdropper observes one honest exchange and does not modify its messages.

The assumption

The computational Diffie–Hellman (CDH) problem is to compute gabg^{ab} given (g,ga,gb)(g,g^a,g^b), for independently uniform a,b∈Zqa,b \in \mathbb{Z}_q.

The CDH assumption says that every efficient algorithm succeeds only with negligible probability, for the chosen family of groups as λ\lambda grows. A prime-order group does not automatically satisfy this assumption; hardness is an additional assumption about the group family. Notice how closely the problem matches the eavesdropper's task. That is what makes this first reduction especially simple.

The reduction

Suppose an efficient attacker A\mathcal{A} recovers KK from an honest transcript with probability ε(λ)\varepsilon(\lambda). We build a CDH solver R\mathcal{R}:

  1. Receive a CDH challenge (g,U,V)(g,U,V), where U=gaU=g^a and V=gbV=g^b. The exponents aa and bb are unknown to R\mathcal{R}.
  2. Give A\mathcal{A} the public group parameters and transcript (X,Y)=(U,V)(X,Y)=(U,V).
  3. Receive the attacker's candidate shared secret K^\widehat{K} and output it as the CDH solution.

Why does this work? The challenge exponents have exactly the distribution used by honest Alice and Bob. Therefore, A\mathcal{A} sees exactly the transcript distribution on which its success guarantee applies. Whenever it recovers the shared secret, its output is

K^=gab,\widehat{K}=g^{ab},

which solves the CDH challenge. Thus,

Pr⁡[R solves CDH]=Pr⁡[A recovers K]=ε(λ).\Pr[\mathcal{R}\text{ solves CDH}] =\Pr[\mathcal{A}\text{ recovers }K] =\varepsilon(\lambda).

The probability includes the random challenge and the attacker's randomness. The reduction makes one call to A\mathcal{A} and performs only a small amount of extra work, so it is efficient whenever A\mathcal{A} is efficient.

We have proved

CDH≤recovering the DH shared secret.\text{CDH} \leq \text{recovering the DH shared secret}.

If ε\varepsilon were non-negligible, our solver would contradict the CDH assumption. Consequently, under that assumption, passive recovery of the shared secret has negligible success probability.

The reduction barely changes the input because we deliberately chose a property that closely matches the assumption. More involved proofs use the same structure, but need additional work to simulate the attacker's environment or translate its output.

What the proof establishes

The precise property matters. Inability to recover all of KK does not imply that an attacker learns nothing about it. A stronger question asks whether the attacker can distinguish the real KK from an independent uniform element of GG, given the transcript. This is the decisional Diffie–Hellman (DDH) problem, involving the distributions

(g,ga,gb,gab)and(g,ga,gb,gc),(g,g^a,g^b,g^{ab}) \quad\text{and}\quad (g,g^a,g^b,g^c),

where a,b,ca,b,c are independently uniform in Zq\mathbb{Z}_q. Assuming CDH alone does not establish this indistinguishability property.

Our proof also says nothing about an attacker who changes messages. Unauthenticated Diffie–Hellman permits a man-in-the-middle attack: an attacker can replace the public shares and establish separate secrets with Alice and Bob. The attacker never needs to solve the CDH challenge from an honest exchange. This illustrates why the attack model is part of the theorem.

A tempting argument in the wrong direction

What if we tried to justify secrecy by saying that discrete logarithms are hard?

The discrete logarithm (DL) problem is to recover aa from gg and gag^a. If we had a DL solver, we could solve CDH: recover aa from gag^a, then compute (gb)a=gab(g^b)^a=g^{ab}. This gives

CDH≤DL.\text{CDH} \leq \text{DL}.

It proves that easy discrete logarithms make CDH easy. Its contrapositive says that hard CDH implies hard discrete logarithms. This reduction does not prove that hard discrete logarithms imply hard CDH: there might be a way to compute gabg^{ab} without recovering either exponent.

That is the same logical mistake as reversing an implication. A security argument must show that any successful attack yields a solver for the assumed hard problem, rather than merely exhibit an attack that uses such a solver.

Reading a Security Proof

When reading a reduction proof, keep four questions in mind:

  1. What exactly does the attacker get to see and do, and what counts as winning?
  2. Which problem is assumed hard, and how are its instances sampled?
  3. How does the reduction turn the attacker into a solver without knowing the hidden solution itself?
  4. What running time and success probability does the solver achieve?

For our Diffie–Hellman example, each answer is short enough to check directly. These same questions will guide us when we introduce formal security games and prove properties of more involved constructions.

Note: AI used for polishing text and finding bugs.