ElGamal
The ElGamal encryption system is an asymetric cryptographic algorithm. A public key is used to encrypt data and a private key is used to decrypt data.
Textbook definition
The variables of textbook ElGamal are:
| Variable | Description |
|---|---|
| A large prime number | |
| A generator of the multiplicative group of integers modulo | |
| The public key | |
| The private key |
The public key is and the private key is .
Key generation
The key generation is very similar to the one of the Diffie-Hellman key exchange.
- Choose a large prime .
- Choose a generator of the multiplicative group of integers modulo .
- Choose a random integer such that .
- Compute the public key:
Encryption (Textbook ElGamal)
To encrypt a message with the public key , compute the ciphertext with:
- Choose a random integer such that .
- Compute the first part of the ciphertext:
- Compute the second part of the ciphertext:
Decryption (Textbook ElGamal)
To decrypt a ciphertext with the private key , compute with:
m is the deciphered message.
Attacks
CCA Padding Oracle
The Textbook ElGamal encryption system is vulnerable to a Chosen Ciphertext Attack (CCA) with a padding oracle.
[FR] 404CTF2022 Writeup