I am trying to do some ElGamal encryption but having a different encryption formula. For that I doing the following steps:
The key generator:
- Choosing value $p = 107$ and $a = 2$
- Random number $d = 67$, and $b = a^d \bmod p$ where $b = 2^{67} \bmod 107 = 94$
- $k_{priv} = 67$ and $k_{pub} = (p,a,b) = (107,2,94)$
Encryption
- Random value $v = 45$ and $C_1 = a^v \bmod p = 2^{45} \bmod 107 = 28$
- We have the message $m = 66$; $C_2 = m \cdot b^v \cdot a^v \bmod 107 = 66 \cdot 94^{45} \cdot 2^{45} \bmod 107 = 38$
- Finally, $C = (C_1, C_2)$
My problem comes when I try to decrypt the message, maybe I am totally wrong. But I am doing:
$C_1 = a^v$
$C_2 = m \cdot a^v \cdot (a^d)^v$
$C_2 = m \cdot C_1 \cdot (a^d)^v$
I trying to do that is where I am a little bit lost. If someone can help me with a clue to decrypt the message I would be nice