Documentation

CslibFrontier.Crypto.Computational.Encryption.IdentityBased

Identity-based encryption and its semantic, private and selective security #

An identity-based encryption scheme IBE MPK MSK ID SK M C has a setup algorithm drawing a master public key and a master secret key, a key generation algorithm deriving a secret key for an identity from the master secret key, encryption to an identity under the master public key, and deterministic decryption with a secret key, where none is the source's reject ([BS23], Section 15.6.1, Definition 15.8, p. 644). IBE.Correct is the correctness requirement of that definition. The record is for one fixed scheme, as PKE and FE are.

The three security notions of [BS23], Sections 15.6.1–15.6.2, are asymptotic and word-level: they take a family WordIBE Msg of schemes whose identities, keys and ciphertexts are bit words, and adversaries whose stages query the key oracle ibeKeyOracle through WordOracleComp Unit with the efficiency predicate IsOraclePPT. Adversaries with a typed key oracle need a typed oracle-PPT predicate, which is not yet in the library (#4894).

There is one experiment, privateIBEGameOn: experiment bit of Attack Game 15.6 (p. 646), in which the adversary names two (identity, message) pairs and receives an encryption of the message of pair bit to the identity of pair bit. The other two games are this experiment run on mapped adversaries:

Conventions of the experiment:

IBEPrivateOn.ibeSemanticOn and IBESemanticOn.ibeSelectiveOn are the implications the source states in words ("a special case", p. 646; "a weaker notion", p. 647). Each applies its hypothesis to the mapped adversary, through the certificates IBEAdversaryOf.IsPPT.toPrivate and SelectiveIBEAdversaryOf.IsPPT.toAdaptive.

Not formalized here: several encryption queries (Remark 15.12), the hashed-identity construction of Theorem 15.5, chosen-ciphertext security (p. 648), identity-based encryption as functional encryption (Example 15.2), and the constructions of Section 15.6.3.

Main definitions #

Main results #

References #

structure Cslib.Crypto.IBE (MPK MSK ID SK M C : Type) :

An identity-based encryption scheme ([BS23], Section 15.6.1, Definition 15.8, p. 644) with master public keys MPK, master secret keys MSK, identities ID, secret keys SK, messages M and ciphertexts C. Decryption returns none for the source's reject.

  • setup : ProbComp (MPK × MSK)

    Setup algorithm S: draw a master public key and a master secret key.

  • keyGen : MSK → ID → ProbComp SK

    Key generation algorithm G: derive a secret key for an identity from the master secret key.

  • encrypt : MPK → ID → M → ProbComp C

    Encryption algorithm E: encrypt a message to an identity under the master public key.

  • decrypt : SK → C → Option M

    Deterministic decryption algorithm D, with none for reject.

def Cslib.Crypto.IBE.Correct {MPK MSK ID SK M C : Type} (E : IBE MPK MSK ID SK M C) :

Correctness of an identity-based encryption scheme ([BS23], Section 15.6.1, Definition 15.8, p. 644): for every supported master key pair, every identity id and every message m, decrypting any supported encryption of m to id with any supported secret key for id gives some m.

@[reducible, inline]

A family of identity-based encryption schemes indexed by the security parameter, whose master keys, identities, secret keys and ciphertexts are bit words and whose messages have type Msg.

@[reducible, inline]

Output ((id, m₀, m₁), state) of the first stage of a semantic-security adversary: the identity word, the two messages under encMsg, then the saved state word. The triple, the identity and m₀ are framed.

@[reducible, inline]

Output (((id₀, m₀), (id₁, m₁)), state) of the first stage of a private-IBE adversary: the two (identity word, message) pairs, then the saved state word. The two pairs together, the first pair and both identities are framed; the second pair is not.

An adversary in Attack Game 15.6 (private IBE, [BS23], Section 15.6.2, p. 646). Both stages query the key oracle: a query is an identity word and its reply is a secret-key word.

Uniform strict oracle PPT admissibility of both stages of a private-IBE adversary.

An adversary in Attack Game 15.5 (semantic security, [BS23], Section 15.6.1, pp. 645–646): it chooses the challenge identity adaptively, after its key queries.

structure Cslib.Crypto.Encryption.IBEAdversaryOf.IsPPT {Msg : Type} (encMsg : Msg ↪ List Bool) (adversary : IBEAdversaryOf Msg) :

Uniform strict oracle PPT admissibility of both stages of a semantic-security adversary.

An adversary in Attack Game 15.7 (selective security, [BS23], Section 15.6.2, p. 647): it names its target identity from the security parameter alone, before it receives the master public key.

Uniform strict (oracle) PPT admissibility of the three stages of a selective adversary.

def Cslib.Crypto.Encryption.ibeKeyOracle {Msg : Type} (E : WordIBE Msg) (n : ℕ) (msk : List Bool) (request : Unit × List Bool) :

The key oracle of [BS23], Attack Game 15.5: answer the identity word request.2 with a fresh secret key from (E n).keyGen msk, and add the identity to the log of queried identities. It is the answer-and-log oracle SignatureScheme.signingOracleOf at (E n).keyGen.

@[simp]
theorem Cslib.Crypto.Encryption.run_ibeKeyOracle {Msg : Type} (E : WordIBE Msg) (n : ℕ) (msk : List Bool) (request : Unit × List Bool) (queried : List (List Bool)) :
(ibeKeyOracle E n msk request).run queried = do let sk ← (E n).keyGen msk request.2 pure (sk, request.2 :: queried)
noncomputable def Cslib.Crypto.Encryption.privateIBEGameOn {Msg : Type} (valid : ℕ → List Bool → List Bool × Msg → List Bool × Msg → Bool) (E : WordIBE Msg) (adversary : PrivateIBEAdversaryOf Msg) (bit : Bool) (n : ℕ) :

Experiment bit of Attack Game 15.6 (private IBE, [BS23], Section 15.6.2, p. 646) with challenge-admissibility predicate valid: draw (mpk, msk); run the first stage on mpk against the logging key oracle, from the empty log; if valid n mpk (id₀, m₀) (id₁, m₁), encrypt the message of pair bit to the identity of pair bit, run the second stage on the ciphertext with the same log, and return the guess when neither id₀ nor id₁ was queried, and false otherwise; if the challenge is inadmissible, return false.

A scheme family with a structured identity space states membership in valid; since identities are compared as words, no key issued for a word outside the space may decrypt a challenge.

A semantic-security adversary as a private-IBE adversary that names its challenge identity in both pairs ([BS23], p. 646: Attack Game 15.5 is Attack Game 15.6 with id₀ = id₁).

A selective adversary as an adaptive one: its first stage draws the target identity from the security parameter alone, without looking at the master public key, and then chooses the messages.

theorem Cslib.Crypto.Encryption.privateIBEGameOn_toPrivate {Msg : Type} (valid : ℕ → List Bool → List Bool × Msg → List Bool × Msg → Bool) (E : WordIBE Msg) (adversary : IBEAdversaryOf Msg) (bit : Bool) (n : ℕ) :
privateIBEGameOn valid E adversary.toPrivate bit n = do let keys ← (E n).setup let out₁ ← (OracleComp.interpret (OracleComp.sumHandler (fun (m : ℕ) => StateT.lift (ProbComp.unifFin m)) (ibeKeyOracle E n keys.2)) (adversary.choose n keys.1)).run [] match out₁.1 with | ((ident, m₀, m₁), state) => if valid n keys.1 (ident, m₀) (ident, m₁) = true then do let ct ← (E n).encrypt keys.1 ident (if bit = true then m₁ else m₀) let out₂ ← (OracleComp.interpret (OracleComp.sumHandler (fun (m : ℕ) => StateT.lift (ProbComp.unifFin m)) (ibeKeyOracle E n keys.2)) (adversary.guess n state ct)).run out₁.2 pure (out₂.1 && !out₂.2.contains ident) else pure false

The experiment on adversary.toPrivate is Attack Game 15.5 ([BS23], Section 15.6.1, pp. 645–646): one challenge identity, an encryption of m_bit to it, and a final check that the identity was not queried.

theorem Cslib.Crypto.Encryption.eval_privateIBEGameOn_toAdaptive {Msg : Type} (valid : ℕ → List Bool → List Bool × Msg → List Bool × Msg → Bool) (E : WordIBE Msg) (adversary : SelectiveIBEAdversaryOf Msg) (bit : Bool) (n : ℕ) :
(privateIBEGameOn valid E adversary.toAdaptive.toPrivate bit n).eval = (do let t ← adversary.target n let keys ← (E n).setup let out₁ ← (OracleComp.interpret (OracleComp.sumHandler (fun (m : ℕ) => StateT.lift (ProbComp.unifFin m)) (ibeKeyOracle E n keys.2)) (adversary.choose n t.2 keys.1)).run [] match out₁.1 with | ((m₀, m₁), state) => if valid n keys.1 (t.1, m₀) (t.1, m₁) = true then do let ct ← (E n).encrypt keys.1 t.1 (if bit = true then m₁ else m₀) let out₂ ← (OracleComp.interpret (OracleComp.sumHandler (fun (m : ℕ) => StateT.lift (ProbComp.unifFin m)) (ibeKeyOracle E n keys.2)) (adversary.guess n state ct)).run out₁.2 pure (out₂.1 && !out₂.2.contains t.1) else pure false).eval

The experiment on adversary.toAdaptive.toPrivate has the law of Attack Game 15.7 ([BS23], Section 15.6.2, p. 647): the target identity is drawn first, from the security parameter alone, then the master keys; the message stage runs on the master public key.

theorem Cslib.Crypto.Encryption.IBEAdversaryOf.IsPPT.toPrivate {Msg : Type} {encMsg : Msg ↪ List Bool} {adversary : IBEAdversaryOf Msg} (hA : IsPPT encMsg adversary) :

toPrivate preserves the efficiency predicate: its first stage reshapes the output of the adversary's first stage by a polynomial-time map.

theorem Cslib.Crypto.Encryption.SelectiveIBEAdversaryOf.IsPPT.toAdaptive {Msg : Type} {encMsg : Msg ↪ List Bool} {adversary : SelectiveIBEAdversaryOf Msg} (hA : IsPPT encMsg adversary) :

toAdaptive preserves the efficiency predicate: its first stage samples the target stage and runs the message stage on the target state and the master public key.

def Cslib.Crypto.Encryption.IBEPrivateOn {Msg : Type} (valid : ℕ → List Bool → List Bool × Msg → List Bool × Msg → Bool) (encMsg : Msg ↪ List Bool) (E : WordIBE Msg) :

Semantically secure and private identity-based encryption ([BS23], Section 15.6.2, Attack Game 15.6 and Definition 15.10, p. 646) for a scheme family E with challenge-admissibility predicate valid: the two experiments of privateIBEGameOn are indistinguishable for every uniform strict oracle PPT private-IBE adversary.

def Cslib.Crypto.Encryption.IBESemanticOn {Msg : Type} (valid : ℕ → List Bool → List Bool × Msg → List Bool × Msg → Bool) (encMsg : Msg ↪ List Bool) (E : WordIBE Msg) :

Semantically secure (adaptively secure) identity-based encryption ([BS23], Section 15.6.1, Attack Game 15.5 and Definition 15.9, pp. 645–646): the experiments of privateIBEGameOn on adversary.toPrivate, which are Attack Game 15.5 (privateIBEGameOn_toPrivate), are indistinguishable for every uniform strict oracle PPT semantic-security adversary.

def Cslib.Crypto.Encryption.IBESelectiveOn {Msg : Type} (valid : ℕ → List Bool → List Bool × Msg → List Bool × Msg → Bool) (encMsg : Msg ↪ List Bool) (E : WordIBE Msg) :

Selectively secure identity-based encryption ([BS23], Section 15.6.2, Attack Game 15.7 and Definition 15.11, p. 647): the experiments of privateIBEGameOn on adversary.toAdaptive.toPrivate, which have the laws of Attack Game 15.7 (eval_privateIBEGameOn_toAdaptive), are indistinguishable for every uniform strict (oracle) PPT selective adversary.

theorem Cslib.Crypto.Encryption.IBEPrivateOn.ibeSemanticOn {Msg : Type} {valid : ℕ → List Bool → List Bool × Msg → List Bool × Msg → Bool} {encMsg : Msg ↪ List Bool} {E : WordIBE Msg} (h : IBEPrivateOn valid encMsg E) :
IBESemanticOn valid encMsg E

A private identity-based encryption scheme is semantically secure ([BS23], Section 15.6.2, p. 646: Attack Game 15.5 is the special case id₀ = id₁ of Attack Game 15.6).

theorem Cslib.Crypto.Encryption.IBESemanticOn.ibeSelectiveOn {Msg : Type} {valid : ℕ → List Bool → List Bool × Msg → List Bool × Msg → Bool} {encMsg : Msg ↪ List Bool} {E : WordIBE Msg} (h : IBESemanticOn valid encMsg E) :
IBESelectiveOn valid encMsg E

A semantically secure identity-based encryption scheme is selectively secure ([BS23], Section 15.6.2, p. 647: selective security is "a weaker notion").