Documentation

CatCryptCore.Examples.ElGamalDDH

ElGamal Encryption and DDH Security #

The ElGamal public-key encryption scheme over a cyclic group with explicit exponents, and its IND-CPA security under the Decisional Diffie–Hellman (DDH) assumption.

The cyclic-group interface CyclicGroup and the DDH games (DDH_real, DDH_ideal, DDH_Advantage) are reused from CatCryptCore.Examples.CyclicGroupDDH.

Overview #

ElGamal encryption operates in a cyclic group G of prime order with generator g:

Security #

ElGamal is IND-CPA secure under the DDH assumption:

The proof uses a game-based approach: define the ElGamal scheme, build the reduction from IND-CPA to DDH, and prove the security bound via message-independence of the ideal game (a bijection-coupling argument).

References #

Decryption Correctness Identity #

Key algebraic identity underlying decryption: c₂ · c₁^(-sk) recovers the message when c₁ = g^r, c₂ = m · pk^r, pk = g^sk. That is m · g^(sk·r) · g^(-sk·r) = m.

ElGamal Encryption Scheme #

ElGamal encryption scheme for a cyclic group G. The scheme is determined by the group, so the structure carries no configuration.

    Instances For
      @[reducible, inline]

      Public key type: a group element.

      Equations
      Instances For
        @[reducible, inline]

        Message type: a group element.

        Equations
        Instances For
          @[reducible, inline]

          Ciphertext type: a pair of group elements (c₁, c₂).

          Equations
          Instances For

            Key generation: sample random x, output (sk = x, pk = g^x).

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              Encryption: Enc(pk, m) = (g^r, m · pk^r) for random r.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Decryption: Dec(sk, (c₁, c₂)) = c₂ · c₁^(-sk).

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  ElGamal presented as an EncScheme.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    IND-CPA Security Game for ElGamal #

                    The IND-CPA game for public-key encryption: the challenger generates (pk, sk), the adversary receives pk, chooses two messages m₀, m₁, and tries to guess which one was encrypted.

                    IND-CPA real game for ElGamal: encrypt m₀.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      IND-CPA ideal game for ElGamal: encrypt m₁.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        IND-CPA advantage for ElGamal.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          Security Reduction: IND-CPA to DDH #

                          Given a DDH challenge (g^a, g^b, z), set pk = g^a and answer the encryption query for message m with (g^b, m · z). If z = g^(ab) this is a valid ElGamal ciphertext; if z = g^c it masks the message with an independent element.

                          The reduction from IND-CPA to DDH: given an IND-CPA adversary A, use the DDH challenge (g^a, g^b, z) to simulate the IND-CPA game with pk = g^a and ct = (g^b, m · z).

                          Equations
                          Instances For

                            Main Security Theorem #

                            The DDH real game with the reduction equals the IND-CPA real game with the adversary.

                            When z = g^c for random c, the ciphertext is independent of the message: for any messages m₀, m₁, the DDH ideal game composed with the reduction gives the same distribution. The map m · g^c is a bijection for fixed m, so m · g^c is uniform, and the two games are coupled by the induced exponent bijection.

                            ElGamal IND-CPA security reduces to DDH: for any adversary A and messages m₀, m₁, the IND-CPA advantage is bounded by the sum of the DDH advantages of the reductions using m₀ and m₁.

                            The proof hops through: IND-CPA real (encrypt m₀) = DDH real reduction with m₀; DDH ideal reduction with m₀ = DDH ideal reduction with m₁ (message independence); DDH real reduction with m₁ = IND-CPA ideal (encrypt m₁).

                            Correctness of ElGamal #

                            ElGamal correctness: decryption recovers the original message. For secret key sk and message m, encrypting with c₁ = g^r and c₂ = m · g^(sk·r) and then decrypting via c₂ · (g^(sk·r))⁻¹ returns m.

                            Bijection Lemmas for the Security Proof #

                            For any m : G, the map b ↦ m · g^b is a bijection: multiplication by m is a bijection and g^b is a bijection. This couples m₀ · g^c and m₁ · g^c' to the same distribution when c and c' are coupled.

                            Equivalence from Exp to G via b ↦ m · g^b, for coupling arguments.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For