Documentation

VCVio.CryptoFoundations.AsymmEncAlg.Defs

Asymmetric Encryption Schemes #

Core definitions for asymmetric encryption schemes and correctness.

structure AsymmEncAlg (m : TypeType u) [Monad m] (M PK SK C : Type) :

An AsymmEncAlg with message space M, key spaces PK and SK, and ciphertexts in C. m is the monad used to execute key generation, encryption, and decryption. The scheme data stays purely algorithmic; probabilistic semantics and public-randomness injection are supplied separately when defining security experiments.

  • keygen : m (PK × SK)
  • encrypt (pk : PK) (msg : M) : m C
  • decrypt (sk : SK) (c : C) : m (Option M)
Instances For
    theorem AsymmEncAlg.ext_iff {m : TypeType u} {inst✝ : Monad m} {M PK SK C : Type} {x y : AsymmEncAlg m M PK SK C} :
    theorem AsymmEncAlg.ext {m : TypeType u} {inst✝ : Monad m} {M PK SK C : Type} {x y : AsymmEncAlg m M PK SK C} (keygen : x.keygen = y.keygen) (encrypt : x.encrypt = y.encrypt) (decrypt : x.decrypt = y.decrypt) :
    x = y
    structure AsymmEncAlg.ExplicitCoins (m : TypeType u) [Monad m] (M PK SK R C : Type) :

    An explicit-coins asymmetric encryption scheme in the monad m.

    Key generation runs in m, while encryption and decryption become pure once the randomness type R is supplied explicitly. This is the natural refinement used by FO-style transforms, where the coins are sampled externally or derived from an oracle.

    • keygen : m (PK × SK)
    • encrypt (pk : PK) (msg : M) (coins : R) : C
    • decrypt (sk : SK) (c : C) : Option M
    Instances For
      @[reducible, inline]
      abbrev PKE_Alg (m : TypeType u_1) [Monad m] (M PK SK C : Type) :
      Type u_1
      Instances For
        def AsymmEncAlg.map {m : TypeType v} [Monad m] {M PK SK C : Type} (encAlg : AsymmEncAlg m M PK SK C) {n : TypeType w} [Monad n] (F : m →ᵐ n) :
        AsymmEncAlg n M PK SK C

        Transport an asymmetric encryption scheme across a monad morphism by mapping each algorithmic component.

        Instances For
          @[simp]
          theorem AsymmEncAlg.map_keygen {m : TypeType v} [Monad m] {M PK SK C : Type} {n : TypeType w} [Monad n] {encAlg : AsymmEncAlg m M PK SK C} (F : m →ᵐ n) :
          (encAlg.map F).keygen = (fun {α : Type} (x : m α) => F.toFun α x) encAlg.keygen
          @[simp]
          theorem AsymmEncAlg.map_encrypt {m : TypeType v} [Monad m] {M PK SK C : Type} {n : TypeType w} [Monad n] {encAlg : AsymmEncAlg m M PK SK C} (F : m →ᵐ n) (pk : PK) (msg : M) :
          (encAlg.map F).encrypt pk msg = (fun {α : Type} (x : m α) => F.toFun α x) (encAlg.encrypt pk msg)
          @[simp]
          theorem AsymmEncAlg.map_decrypt {m : TypeType v} [Monad m] {M PK SK C : Type} {n : TypeType w} [Monad n] {encAlg : AsymmEncAlg m M PK SK C} (F : m →ᵐ n) (sk : SK) (c : C) :
          (encAlg.map F).decrypt sk c = (fun {α : Type} (x : m α) => F.toFun α x) (encAlg.decrypt sk c)
          def AsymmEncAlg.CorrectExp {m : TypeType v} [Monad m] {M PK SK C : Type} (encAlg : AsymmEncAlg m M PK SK C) [DecidableEq M] (msg : M) :

          Correctness experiment: returns true iff decrypting the ciphertext recovers the message.

          The game returns a Bool directly rather than using guard, so it does not require AlternativeMonad.

          Instances For
            def AsymmEncAlg.PerfectlyCorrect {m : TypeType v} [Monad m] {M PK SK C : Type} (encAlg : AsymmEncAlg m M PK SK C) [DecidableEq M] (runtime : ProbCompRuntime m) :

            An asymmetric encryption scheme is perfectly correct under the given runtime when decrypting a fresh encryption of any message succeeds with probability 1.

            Instances For
              def AsymmEncAlg.ExplicitCoins.toAsymmEncAlg {m : TypeType v} [Monad m] {M PK SK R C : Type} (encAlg : ExplicitCoins m M PK SK R C) [SampleableType R] (runtime : ProbCompRuntime m) :
              AsymmEncAlg m M PK SK C

              Forget the explicit-coins presentation by sampling the coins through the ambient runtime's public-randomness capability.

              Instances For