ElGamal encryption (original) (raw)

From Wikipedia, the free encyclopedia

Public-key cryptosystem

In cryptography, the ElGamal encryption system is an asymmetric key encryption algorithm for public-key cryptography which is based on the Diffie–Hellman key exchange. It was described by Taher Elgamal in 1985.[1] ElGamal encryption is used in the free GNU Privacy Guard software, recent versions of PGP, and other cryptosystems. The Digital Signature Algorithm (DSA) is a variant of the ElGamal signature scheme, which should not be confused with ElGamal encryption.

ElGamal encryption can be defined over any cyclic group G {\displaystyle G} {\displaystyle G}, like multiplicative group of integers modulo n if and only if n is 1, 2, 4, p k or 2_p_ k, where p is an odd prime and k > 0. Its security depends upon the difficulty of a certain problem in G {\displaystyle G} {\displaystyle G} related to computing discrete logarithms.

The algorithm can be described as first performing a Diffie–Hellman key exchange to establish a shared secret s {\displaystyle s} {\displaystyle s}, then using this as a one-time pad for encrypting the message. ElGamal encryption is performed in three phases: the key generation, the encryption, and the decryption. The first is purely key exchange, whereas the latter two mix key exchange computations with message computations.

The first party, Alice, generates a key pair as follows:

A second party, Bob, encrypts a message M {\displaystyle M} {\displaystyle M} to Alice under her public key ( G , q , g , h ) {\displaystyle (G,q,g,h)} {\displaystyle (G,q,g,h)} as follows:

Note that if one knows both the ciphertext ( c 1 , c 2 ) {\displaystyle (c_{1},c_{2})} {\displaystyle (c_{1},c_{2})} and the plaintext m {\displaystyle m} {\displaystyle m}, one can easily find the shared secret s {\displaystyle s} {\displaystyle s}, since c 2 ⋅ m − 1 = s {\displaystyle c_{2}\cdot m^{-1}=s} {\displaystyle c_{2}\cdot m^{-1}=s}. Therefore, a new y {\displaystyle y} {\displaystyle y} and hence a new s {\displaystyle s} {\displaystyle s} is generated for every message to improve security. For this reason, y {\displaystyle y} {\displaystyle y} is also called an ephemeral key.

Alice decrypts a ciphertext ( c 1 , c 2 ) {\displaystyle (c_{1},c_{2})} {\displaystyle (c_{1},c_{2})} with her private key x {\displaystyle x} {\displaystyle x} as follows:

Like most public key systems, the ElGamal cryptosystem is usually used as part of a hybrid cryptosystem, where the message itself is encrypted using a symmetric cryptosystem, and ElGamal is then used to encrypt only the symmetric key. This is because asymmetric cryptosystems like ElGamal are usually slower than symmetric ones for the same level of security, so it is faster to encrypt the message, which can be arbitrarily large, with a symmetric cipher, and then use ElGamal only to encrypt the symmetric key, which usually is quite small compared to the size of the message.

The security of the ElGamal scheme depends on the properties of the underlying group G {\displaystyle G} {\displaystyle G} as well as any padding scheme used on the messages. If the computational Diffie–Hellman assumption (CDH) holds in the underlying cyclic group G {\displaystyle G} {\displaystyle G}, then the encryption function is one-way.[2]

If the decisional Diffie–Hellman assumption (DDH) holds in G {\displaystyle G} {\displaystyle G}, then ElGamal achieves semantic security.[2][3] Semantic security is not implied by the computational Diffie–Hellman assumption alone. See Decisional Diffie–Hellman assumption for a discussion of groups where the assumption is believed to hold.

ElGamal encryption is unconditionally malleable, and therefore is not secure under chosen ciphertext attack. For example, given an encryption ( c 1 , c 2 ) {\displaystyle (c_{1},c_{2})} {\displaystyle (c_{1},c_{2})} of some (possibly unknown) message m {\displaystyle m} {\displaystyle m}, one can easily construct a valid encryption ( c 1 , 2 c 2 ) {\displaystyle (c_{1},2c_{2})} {\displaystyle (c_{1},2c_{2})} of the message 2 m {\displaystyle 2m} {\displaystyle 2m}.

To achieve chosen-ciphertext security, the scheme must be further modified, or an appropriate padding scheme must be used. Depending on the modification, the DDH assumption may or may not be necessary.

Other schemes related to ElGamal which achieve security against chosen ciphertext attacks have also been proposed. The Cramer–Shoup cryptosystem is secure under chosen ciphertext attack assuming DDH holds for G {\displaystyle G} {\displaystyle G}. Its proof does not use the random oracle model. Another proposed scheme is DHIES,[4] whose proof requires an assumption that is stronger than the DDH assumption.

ElGamal encryption is probabilistic, meaning that a single plaintext can be encrypted to many possible ciphertexts, with the consequence that a general ElGamal encryption produces a 1:2 expansion in size from plaintext to ciphertext.

Encryption under ElGamal requires two exponentiations; however, these exponentiations are independent of the message and can be computed ahead of time if needed. Decryption requires one exponentiation and one computation of a group inverse, which can, however, be easily combined into just one exponentiation.

  1. ^ Taher ElGamal (1985). "A Public-Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms" (PDF). IEEE Transactions on Information Theory. 31 (4): 469–472. CiteSeerX 10.1.1.476.4791. doi:10.1109/TIT.1985.1057074. S2CID 2973271. (conference version appeared in CRYPTO'84, pp. 10–18)
  2. ^ a b Mike Rosulek (2008-12-13). "Elgamal encryption scheme". University of Illinois at Urbana-Champaign. Archived from the original on 2016-07-22.
  3. ^ Tsiounis, Yiannis; Yung, Moti (2006-05-24). "On the security of ElGamal based encryption". Public Key Cryptography. Lecture Notes in Computer Science. Vol. 1431. pp. 117–134. doi:10.1007/BFb0054019. ISBN 978-3-540-69105-1.
  4. ^ Abdalla, Michel; Bellare, Mihir; Rogaway, Phillip (2001-01-01). "The Oracle Diffie-Hellman Assumptions and an Analysis of DHIES". Topics in Cryptology — CT-RSA 2001. Lecture Notes in Computer Science. Vol. 2020. pp. 143–158. doi:10.1007/3-540-45353-9_12. ISBN 978-3-540-41898-6.