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 and , the implication
means “if is true, then is true.” We call a sufficient condition for , and a necessary condition for .
An implication is false only when is true and is false. When is false, the implication places no restriction on .
For example, for an integer ,
where means “ divides .” Every multiple of four is even. But the converse, , is false: take .
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 means “not .” The contrapositive of is
These two implications are logically equivalent. If guarantees , then being false rules out being true.

In our divisibility example, the contrapositive says that if 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
We often do so by proving the contrapositive:
The second statement gives us something concrete to build: an algorithm that turns an attack into a solver.
Double implications
The statement , read “ if and only if ,” means that both and hold. To prove it, we must prove both directions.
For example, an integer is even if and only if there exists an integer such that . 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 : “ is even.” A quantifier tells us which values of the variable the assertion covers:
- means “for every in the set , holds.”
- means “there exists an in for which holds.”
For example, is true, as is . Here is the set of integers.
The order of quantifiers matters. Compare
with
The first is true: after seeing , choose . The second is false: no single integer is larger than every integer. In the first statement, may depend on ; in the second, one must work for all .
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:
“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:
Two other useful rules are De Morgan's laws:
where means “and” and means “or.” Also, negating an implication gives : a counterexample must satisfy the hypothesis and violate the conclusion.
Reductions
Which way does a reduction go?
We say that problem reduces to problem if we can solve using a solver for . We write
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 , uses a solver for , 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,
Taking the contrapositive gives
So is at least as hard as , 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, is usually a computational problem, and is the task of breaking a particular security property of a construction. The goal is to show
We assume we have an attacker and construct a solver that uses it. Typically, embeds its hard-problem instance into an interaction with , answers the attacker's allowed queries, and extracts a solution from its output.
We must justify three things:
- The attacker's view: the interaction has the distribution required by the security definition, or is sufficiently close in a precisely justified sense.
- Success: the attacker's success gives the solver a solution with a useful probability.
- 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 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 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 , and it may use randomness.
A function is negligible if, for every positive integer , there is a threshold such that
For example, is negligible, while 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 be a cyclic group of prime order , with public generator . This means that the elements of are the powers of , with exponents taken modulo . We assume group operations are efficient.
For a concrete picture, we could use a subgroup of the nonzero integers modulo a prime . Then the powers below are computed modulo . We will use group notation so that the argument does not depend on that particular representation.
The exchange works as follows:
- Alice samples uniformly from and sends .
- Bob independently samples uniformly from and sends .
- Alice computes , and Bob computes .
They obtain the same value because
Call this shared group element . 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 , cannot efficiently recover the entire value 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 given , for independently uniform .
The CDH assumption says that every efficient algorithm succeeds only with negligible probability, for the chosen family of groups as 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 recovers from an honest transcript with probability . We build a CDH solver :
- Receive a CDH challenge , where and . The exponents and are unknown to .
- Give the public group parameters and transcript .
- Receive the attacker's candidate shared secret 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, sees exactly the transcript distribution on which its success guarantee applies. Whenever it recovers the shared secret, its output is
which solves the CDH challenge. Thus,
The probability includes the random challenge and the attacker's randomness. The reduction makes one call to and performs only a small amount of extra work, so it is efficient whenever is efficient.
We have proved
If 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 does not imply that an attacker learns nothing about it. A stronger question asks whether the attacker can distinguish the real from an independent uniform element of , given the transcript. This is the decisional Diffie–Hellman (DDH) problem, involving the distributions
where are independently uniform in . 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 from and . If we had a DL solver, we could solve CDH: recover from , then compute . This gives
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 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:
- What exactly does the attacker get to see and do, and what counts as winning?
- Which problem is assumed hard, and how are its instances sampled?
- How does the reduction turn the attacker into a solver without knowing the hidden solution itself?
- 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.
- ← Previous
This is my first post. - Next →
Dupont on Halloween