Documentation

CslibFrontier.Crypto.Computational.Encryption.Scheme

Public-key encryption schemes #

A public-key encryption scheme PKE PK SK M C has typed public keys, secret keys, messages and ciphertexts. Key generation and encryption are probabilistic programs; decryption is a function that returns none on a ciphertext it rejects ([BS23], Section 11.2, Definition 11.1). Correctness is a separate property (PKE.Correct), so a scheme with decryption errors is still a PKE.

PKE.cpaExperiment is the single-challenge chosen-plaintext experiment of one fixed scheme ([BS23], Section 11.2, Attack Game 11.1, p. 436): draw a key pair and run the left-or-right experiment lrExperiment on the public key. The adversary is a TwoStage adversary with an arbitrary state type. The admissibility predicate valid decides which challenge pairs are allowed; Attack Game 11.1 requires equal lengths, and an inadmissible pair outputs false on both sides. Asymptotic security over a family of schemes and the efficiency of the adversary are stated on top of this experiment.

Main definitions #

Main results #

References #

structure Cslib.Crypto.PKE (PK SK M C : Type) :

A public-key encryption scheme ([BS23], Definition 11.1) with public keys PK, secret keys SK, messages M and ciphertexts C.

  • keyGen : ProbComp (PK × SK)

    Key generation: draw a public key and its secret key.

  • encrypt : PK → M → ProbComp C

    Encryption of a message under a public key.

  • decrypt : SK → C → Option M

    Decryption of a ciphertext with a secret key; none rejects the ciphertext.

def Cslib.Crypto.PKE.Correct {PK SK M C : Type} (E : PKE PK SK M C) :

A scheme is correct when decryption recovers every honestly encrypted message: for every key pair that key generation can output and every ciphertext that encryption of m can output, decryption with the secret key returns m ([BS23], Definition 11.1).

def Cslib.Crypto.PKE.cpaExperiment {PK SK M C σ : Type} (E : PKE PK SK M C) (valid : PK → M → M → Bool) (A : TwoStage PK (MessagePair M) C Bool σ) (b : Bool) :

The single-challenge chosen-plaintext experiment of the scheme E with challenge-pair admissibility predicate valid ([BS23], Section 11.2, Attack Game 11.1, p. 436). Draw a key pair and run the left-or-right experiment on the public key: the adversary chooses two messages from the public key; if valid pk m₀ m₁ holds, the challenger encrypts the message selected by b and returns the adversary's guess, and otherwise it returns false. The secret key is never passed to the adversary.

theorem Cslib.Crypto.PKE.eval_cpaExperiment {PK SK M C σ : Type} (E : PKE PK SK M C) (valid : PK → M → M → Bool) (A : TwoStage PK (MessagePair M) C Bool σ) (b : Bool) :

The chosen-plaintext experiment observes only the public-key marginal of key generation: it is the left-or-right experiment on a public key drawn from that marginal.