Standard Security Definitions #
This file provides abstract security definitions for the most common cryptographic security notions. These serve as a reference catalog and provide reusable building blocks for security proofs.
Main definitions #
Indistinguishability #
INDCPA_Game— IND-CPA (Indistinguishability under Chosen Plaintext Attack)INDCCA_Game— IND-CCA (Indistinguishability under Chosen Ciphertext Attack)
Pseudorandomness #
PRFScheme— Pseudorandom function familyPRF_Game— PRF indistinguishability game
Authentication #
MACScheme— Message authentication codeEUF_CMA_Game— Existential Unforgeability under Chosen Message Attack
Concrete instantiations #
These abstract definitions are instantiated in the example files:
CatCrypt.Examples.INDCPA— IND-CPA forEncSchemeCatCrypt.Examples.INDCCA— IND-CCA forEncSchemeCatCrypt.Examples.PRF— PRF security for Bool-based PRFCatCrypt.Examples.MAC— MAC security for Bool-based MACCatCrypt.Examples.Schnorr— EUF-CMA for Schnorr signaturesCatCrypt.Examples.ElGamal— IND-CPA for ElGamal PKECatCrypt.Examples.PKE.Scheme— OT-CPA and MT-CPA for PKE
References #
- [Bellare & Rogaway, Introduction to Modern Cryptography]
- [Katz & Lindell, Introduction to Modern Cryptography, 3rd ed.]
- [Rosulek, The Joy of Cryptography]
IND-CPA: Indistinguishability under Chosen Plaintext Attack #
IND-CPA game for a symmetric encryption scheme.
The adversary chooses two messages and receives an encryption of one. The game returns the ciphertext; the adversary tries to guess which message was encrypted.
INDCPA_Game E m₀ m₁ true— encryptsm₀(left/real)INDCPA_Game E m₀ m₁ false— encryptsm₁(right/ideal)
Equations
Instances For
IND-CPA advantage: distinguishing probability between left and right.
Equations
Instances For
IND-CCA: Indistinguishability under Chosen Ciphertext Attack #
IND-CCA extends IND-CPA by handing the adversary a decryption oracle on
ciphertexts other than the challenge. In this single-shot SPComp game framework
a decryption oracle is faithfully modelled as an ordinary Lean function
E.Ciphertext → SPComp (Option E.Plaintext) that closes over the game's secret
key k; the CCA2 "may not query the challenge" restriction is enforced by the
guard if c = cStar then none else E.decrypt k c. No oracle-state threading is
needed because decryption is stateless — it only reads the key. The adversary
takes the oracle as an explicit argument and may call it on any ciphertext, so
the oracle is genuinely reachable (not a dead argument).
The restricted (off-challenge) decryption oracle used by the IND-CCA game:
decrypt with the real key k, except reject (none) the challenge ciphertext
cStar itself. This is the CCA2 restriction.
Equations
- CatCrypt.Crypto.SecurityDefs.ccaDecOracle E k cStar c = if c = cStar then CatCrypt.Core.SPComp.pure none else E.decrypt k c
Instances For
The ideal always-reject decryption oracle: every ciphertext is rejected. This is the oracle of an ideal authenticated-encryption scheme, against which the real oracle is compared to measure ciphertext-integrity.
Instances For
IND-CCA game (CCA2, find-then-guess with a fixed message pair). The adversary
A receives the challenge ciphertext together with the off-challenge
decryption oracle ccaDecOracle E k cStar, and outputs a guess bit.
INDCCA_Game E m₀ m₁ true A— encryptsm₀(left/real)INDCCA_Game E m₀ m₁ false A— encryptsm₁(right/ideal)
Equations
- CatCrypt.Crypto.SecurityDefs.INDCCA_Game E m₀ m₁ b A = do let k ← E.keyGen let cStar ← E.encrypt k (if b = true then m₀ else m₁) A (CatCrypt.Crypto.SecurityDefs.ccaDecOracle E k cStar) cStar
Instances For
IND-CCA advantage: distinguishing probability between the m₀- and m₁-worlds
when the adversary has decryption-oracle access.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The IND-CCA game with the real decryption oracle replaced by the ideal
always-reject oracle. Since the reject oracle ignores the key, this game
collapses to an IND-CPA game whose adversary ignores its (useless) oracle
(see INDCCA_rejectGame_eq).
Equations
- CatCrypt.Crypto.SecurityDefs.INDCCA_rejectGame E m₀ m₁ b A = do let k ← E.keyGen let cStar ← E.encrypt k (if b = true then m₀ else m₁) A (CatCrypt.Crypto.SecurityDefs.rejectDecOracle E) cStar
Instances For
The always-reject IND-CCA game is exactly an IND-CPA game post-composed with the adversary reading its useless oracle: the reject oracle ignores the key, so the challenge production factors out by monad associativity.
PRF: Pseudorandom Function #
PRF real game: evaluate PRF with random key.
Equations
- CatCrypt.Crypto.SecurityDefs.PRF_Real F x = do let k ← CatCrypt.Core.SPComp.sample F.Key CatCrypt.Core.SPComp.pure (F.eval k x)
Instances For
PRF ideal game: return a uniformly random value.
Instances For
PRF advantage: distinguishing PRF output from random.
Equations
Instances For
MAC: Message Authentication Code #
A message authentication code scheme.
- Key : Type
Key type
- Message : Type
Message type
- Tag : Type
Tag type
- decTag : DecidableEq self.Tag
Tag generation
Verification (default: recompute and compare)
Instances For
EUF-CMA real game (simplified, single-query): adversary receives a tag on message m and tries to forge on m*.
Returns true if the adversary's forgery attempt verifies.
Equations
- CatCrypt.Crypto.SecurityDefs.EUF_CMA_Real M m m_star t_star = do let k ← CatCrypt.Core.SPComp.sample M.Key have _t : M.Tag := M.mac k m CatCrypt.Core.SPComp.pure (M.verify k m_star t_star)
Instances For
EUF-CMA advantage: probability of successful forgery.
Equations
- CatCrypt.Crypto.SecurityDefs.EUF_CMA_Adv M m m_star t_star A = CatCrypt.Crypto.prTrue (CatCrypt.Crypto.SecurityDefs.EUF_CMA_Real M m m_star t_star >>= A) CatCrypt.Core.Heap.empty
Instances For
Advantage Bounds #
If a PRF is perfect (PRF output = random for all inputs), PRF advantage is 0.
If encryption is perfectly indistinguishable, IND-CPA advantage is 0.
If the two IND-CCA oracle-games are perfectly indistinguishable, the IND-CCA
advantage is 0. Note the hypothesis quantifies over the whole oracle-game
(adversary and decryption oracle included); for a genuinely confidential scheme
with two distinct messages it is only met degenerately (e.g. m₀ = m₁), because
the decryption oracle's answers depend on the secret key.
IND-CCA reduces to IND-CPA plus decryption-oracle integrity. For any encryption scheme, the IND-CCA advantage is bounded by
- the two authenticity gaps — the advantage of distinguishing the real decryption oracle from the always-reject oracle, in each world — plus
- the IND-CPA advantage of the adversary that ignores its (reject) oracle.
This is the standard "authenticated encryption = confidentiality + integrity"
decomposition, proved here purely from the triangle inequality for advantage:
routing through the two always-reject games, whose difference is an IND-CPA
game (INDCCA_rejectGame_eq). The two authenticity gaps are exactly the
ciphertext-integrity (MAC-unforgeability) terms.