logo

ElGamal Public Key Cryptosystem Proof 📂Number Theory

ElGamal Public Key Cryptosystem Proof

Buildup

20190221_153017.png

From left to right, let’s name them Alice, Bob, and Eve. Alice and Bob are the parties exchanging messages, and Eve is a passive attacker interested in the message. The orange box represents information known only to Alice, the sky-blue box represents information known only to Bob, and the black box represents public information (also known to Eve).

Alice has a message mNm \in \mathbb{N} to receive from Bob.

Algorithm 1

Fp=Fp{0}={1,g,g2,,gp2}\mathbb{F}_{p}^{ \ast } = \mathbb{F}_{p} \setminus \left\{ 0 \right\} = \left\{ 1, g , g^2 , \cdots , g^{p-2} \right\} Let’s say it’s a cyclic group with (p1)(p-1) elements.


Key Setup: Publicly choose a very large prime number pp and ordp(g)\text{ord}_{p} (g), which is a large prime number, as gFpg \in \mathbb{F}_{p}^{ \ast }.

Alice decides on a key 1ap11 \le a \le p-1, known only to herself, and computes Aga(modp)A \equiv g^{a} \pmod{p} to make it public.

20190221_153225.png


Encryption: Generate a one-time random key kk. Bob calculates c1gk(modp)c_{1} \equiv g^{k} \pmod{p} and c2mAk(modp)c_{2} \equiv m A^{k} \pmod{p} to transmit (c1,c2)(c_{1} , c_{2}) to Alice.

20190221_153238.png


Decryption: Using (c1,c2)(c_{1} , c_{2}), Alice computes x(c1a)1c2m(modp)x \equiv (c_{1}^{a} )^{-1} c_{2} \equiv m \pmod{p} to obtain x=mx = m. It’s realistically impossible for Eve to know aa, therefore, she can’t know mm.

20190221_153317.png

Explanation

In fact, there’s no need for the order ordp(g)\text{ord}_{p} (g) of gg to be large in the system itself, but choosing a number with a large order is better to reduce the possibility of obtaining it by brute force.

Proof

Decryption

Since Alice knows aa, and c1gk(modp)c_{1} \equiv g^{k} \pmod{p} and c2mAk(modp)c_{2} \equiv m A^{k} \pmod{p}, she can easily compute (c1a)1c2(gak)1c2(gak)1(mAk)(gak)1(m(ga)k)m(gak)1gakm(modp) \begin{align*} (c_{1}^{a} )^{-1} c_{2} & \equiv \left( g^{ak} \right)^{-1} \cdot c_{2} \\ & \equiv \left( g^{ak} \right)^{-1} \cdot \left( m A^{k} \right) \\ & \equiv \left( g^{ak} \right)^{-1} \cdot \left( m \left( g^{a} \right)^{k} \right) \\ & \equiv m \left( g^{ak} \right)^{-1} \cdot g^{ak} \\ & \equiv m \pmod{p} \end{align*} without knowing kk.

Encryption

Since Eve only knows c1c_{1} and c2c_{2}, not aa and kk, she cannot know the discrete logarithm problem gxc1a(modp){g}^{x} \equiv c_{1}^{a} \pmod{p}, and even if she did, she would need to solve it directly. Since this is very difficult, Bob can safely transmit the message mm to Alice.

See Also

Security algorithms utilizing the difficulty of the discrete logarithm problem

Attack algorithms on the discrete logarithm problem


  1. Hoffstein. (2008). An Introduction to Mathematical Cryptography: p70. ↩︎