Skip to content
Chaoran Huang
Applied Cryptography

Cryptography is About Definitions, Not Secrets

Part 1 of 6. Encryption syntax, security parameters, perfect and semantic security, IND-CPA, and the reduction from a definition to a construction.

Outline — prose not written

The ramp stays concrete: define the scheme, see why perfect secrecy is too expensive, then introduce computational security and its game-based form.

Throughline

Security is not “the plaintext looks scrambled.” It is a quantified claim about an attacker, its resources, and what counts as winning.

1. Define the object before securing it

  • A symmetric-key encryption scheme is Π=(Gen,Enc,Dec)\Pi=(\mathsf{Gen},\mathsf{Enc},\mathsf{Dec}):
kGen(1λ),cEnck(m),m:=Deck(c)k\leftarrow\mathsf{Gen}(1^\lambda),\qquad c\leftarrow\mathsf{Enc}_k(m),\qquad m':=\mathsf{Dec}_k(c)
  • Explain the notation:
    • \leftarrow allows randomized output.
    • :=:= denotes deterministic assignment.
    • λ\lambda indexes a family of schemes; for now, treat it as the security knob.
  • Define correctness first:
Pr[Deck(Enck(m))=m]=1\Pr[\mathsf{Dec}_k(\mathsf{Enc}_k(m))=m]=1
  • Note that some schemes, especially lattice-based ones, permit negligible decryption failure; return to that in Part 6.
  • Introduce Kerckhoffs's principle: algorithms are public, while generated secret values remain secret.
  • Use a substitution cipher to separate “large key space” from “secure.”

Reference: Katz–Lindell §2.1

2. First attempt: reveal absolutely nothing

  • Work one one-time-pad example:
Enc(k,m)=mk,Dec(k,c)=ck\mathsf{Enc}(k,m)=m\oplus k,\qquad \mathsf{Dec}(k,c)=c\oplus k
  • Define perfect secrecy through identical ciphertext distributions:
Enck(m0)Enck(m1)\mathsf{Enc}_k(m_0)\equiv\mathsf{Enc}_k(m_1)
  • Give the equivalent posterior view:
Pr[M=mC=c]=Pr[M=m]\Pr[M=m\mid C=c]=\Pr[M=m]
  • Explain why a uniform one-time-pad key achieves it.
  • Show key reuse leaking the XOR of both messages:
c1c2=m1m2c_1\oplus c_2=m_1\oplus m_2
  • Use Shannon's theorem as the limit:
KM|\mathcal K|\ge|\mathcal M|
  • Land the problem: perfect secrecy works, but securely distributing a message-sized one-use key is the problem encryption was meant to solve.

Reference: Katz–Lindell ch. 2; Shannon (1949)

3. The escape: computational security

  • Weaken “identical distributions” to “no efficient algorithm can distinguish them.”
  • Return to λ\lambda and define:
    • adversary runtime: poly(λ)\mathsf{poly}(\lambda)
    • advantage: a function of λ\lambda
    • acceptable advantage: negligible in λ\lambda
c>0, N, λ>N:ν(λ)<1λc\forall c>0,\ \exists N,\ \forall\lambda>N: \quad \nu(\lambda)<\frac1{\lambda^c}
  • Use examples to separate asymptotic and concrete claims:
FunctionNegligible?Why
2λ2^{-\lambda}YesEventually smaller than every inverse polynomial
λ100\lambda^{-100}NoIt is itself an inverse polynomial
21282^{-128}No, as a function of λ\lambdaConstant asymptotically, but tiny as a concrete probability
  • Distinguish three quantities often collapsed into “security parameter”:
    • theoretical parameter λ\lambda
    • concrete parameter sizes, such as an RSA modulus or AES key
    • estimated security level, such as 128 bits of work
  • Use the 21282^{128} arithmetic as intuition only; not every scheme with λ=128\lambda=128 costs 21282^{128} to break.

Reference: Katz–Lindell §3.1

4. The intuitive goal: semantic security

  • State semantic security in the chosen-plaintext setting:

    Given a ciphertext and allowed side information, an efficient attacker should learn no efficiently computable property of the plaintext that it could not predict without the ciphertext.

  • Use a concrete example: encrypting a salary should hide not only the amount but also predicates such as “is it above $100,000?”

  • Explain why “the attacker cannot recover the entire plaintext” is too weak.

  • Include equality and repeated-message leakage as useful counterexamples.

  • Explain why the semantic definition matches the real goal but is cumbersome to prove directly.

Reference: Goldwasser–Micali (1982); Katz–Lindell ch. 3

5. The equivalent game: IND-CPA

  • State the bridge explicitly: semantic security under chosen-plaintext attack is equivalent to IND-CPA.
  • Define the experiment:
    1. kGen(1λ)k\leftarrow\mathsf{Gen}(1^\lambda).
    2. The adversary queries an encryption oracle.
    3. It submits equal-length m0,m1m_0,m_1.
    4. The challenger samples b{0,1}b\leftarrow\{0,1\} and returns cEnck(mb)c^*\leftarrow\mathsf{Enc}_k(m_b).
    5. The adversary may continue querying, then outputs bb'.
AdvΠind-cpa(A,λ)=Pr[b=b]12\mathsf{Adv}^{\mathsf{ind\text{-}cpa}}_\Pi(A,\lambda) =\left|\Pr[b'=b]-\tfrac12\right|
  • Require negligible advantage for every PPT adversary.
  • Explain each design choice:
    • equal lengths remove trivial length leakage
    • oracle access models attacker-controlled plaintexts; for public-key encryption, anyone can encrypt already
    • randomized encryption prevents direct comparison
  • Give the equivalence intuition:
    • learning a predicate distinguishes messages chosen to differ on that predicate
    • distinguishing messages reveals a predicate of the hidden message
  • Show deterministic encryption losing immediately.
  • Use ECB as the visual example: AES remains sound, but deterministic composition leaks structure.
  • Keep the proof boundary clear:
    • a winning adversary disproves security
    • failing to find one does not prove security
    • a reduction proves that a winner would break an assumed-hard primitive

Figure to add — the ECB penguin

Add /figures/cryptography/ecb-penguin.png. The caption should separate the secure primitive from the insecure deterministic mode.

Reference: Katz–Lindell ch. 3

6. From definition to construction

  • Show the smallest PRF-based randomized scheme:
r{0,1}λ,c=(r, Fk(r)m)r\leftarrow\{0,1\}^\lambda,\qquad c=(r,\ F_k(r)\oplus m)
  • State the requirements:
    • Fk(r)F_k(r) is at least as long as mm
    • FF is a secure PRF
    • rr is fresh; collisions among polynomially many encryptions are negligible
  • Sketch the hybrid proof:
    1. Replace FkF_k with a truly random function using PRF security.
    2. Condition on a fresh rr.
    3. The challenge mask is uniform, so the hidden bit is independent of the ciphertext.
  • Record the concrete bound:
Advind-cpaAdvprf+O(q2/2λ)\mathsf{Adv}^{\mathsf{ind\text{-}cpa}} \le \mathsf{Adv}^{\mathsf{prf}} + O(q^2/2^\lambda)
  • State what IND-CPA does not provide: ciphertext integrity or resistance to active tampering. That is the opening problem for Part 2.

Assumptions introduced

  • One-way functions exist.
  • PRFs can be constructed from one-way functions.
  • Practical block ciphers such as AES are modeled as secure PRPs.

Go deeper

  • Katz–Lindell ch. 2–3
  • Boneh–Shoup ch. 2–5
  • Goldwasser–Micali, Probabilistic Encryption (1982)
  • Shannon, Communication Theory of Secrecy Systems (1949)
  • Scribed applied cryptography notes, §2.1