ElGamal encryption
Incryptography,theElGamal encryption systemis anasymmetric key encryption algorithmforpublic-key cryptographywhich is based on theDiffie–Hellman key exchange.It was described byTaher Elgamalin 1985.[1]ElGamal encryption is used in the freeGNU Privacy Guardsoftware, recent versions ofPGP,and othercryptosystems.TheDigital Signature Algorithm(DSA) is a variant of theElGamal signature scheme,which should not be confused with ElGamal encryption.
ElGamal encryption can be defined over anycyclic group,likemultiplicative group of integers modulonif and only ifnis 1, 2, 4,pkor 2pk,wherepis an odd prime andk> 0.Its security depends upon the difficulty of a certain problem inrelated to computingdiscrete logarithms.
The algorithm
[edit]The algorithm can be described as first performing a Diffie–Hellman key exchange to establish a shared secret,then using this as aone-time padfor 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.
Key generation
[edit]The first party, Alice, generates a key pair as follows:
- Generate an efficient description of acyclic groupoforderwithgenerator.Letrepresent the identity element of.
- It is not necessary to come up with a group and generator for each new key. Indeed, one may expect a specific implementation of ElGamal to be hardcoded to use a specific group, or a group from a specific suite. The choice of group is mostly about how large keys you want to use.
- Choose an integerrandomly from.
- Compute.
- Thepublic keyconsists of the values.Alice publishes this public key and retainsas herprivate key,which must be kept secret.
Encryption
[edit]A second party, Bob, encrypts a messageto Alice under her public keyas follows:
- Map the messageto an elementofusing a reversible mapping function.
- Choose an integerrandomly from.
- Compute.This is called theshared secret.
- Compute.
- Compute.
- Bob sends the ciphertextto Alice.
Note that if one knows both the ciphertextand the plaintext,one can easily find the shared secret,since.Therefore, a newand hence a newis generated for every message to improve security. For this reason,is also called anephemeral key.
Decryption
[edit]Alice decrypts a ciphertextwith her private keyas follows:
- Compute.Since,,and thus it is the same shared secret that was used by Bob in encryption.
- Compute,the inverse ofin the group.This can be computed in one of several ways. Ifis a subgroup of a multiplicative group of integers modulo,whereis prime, themodular multiplicative inversecan be computed using theextended Euclidean algorithm.An alternative is to computeas.This is the inverse ofbecause ofLagrange's theorem,since.
- Compute.This calculation produces the original message,because;hence.
- Mapback to the plaintext message.
Practical use
[edit]Like most public key systems, the ElGamal cryptosystem is usually used as part of ahybrid 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 samelevel 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.
Security
[edit]The security of the ElGamal scheme depends on the properties of the underlying groupas well as any padding scheme used on the messages. If thecomputational Diffie–Hellman assumption(CDH) holds in the underlying cyclic group,then the encryption function isone-way.[2]
If thedecisional Diffie–Hellman assumption(DDH) holds in,then ElGamal achievessemantic security.[2][3]Semantic security is not implied by the computational Diffie–Hellman assumption alone. SeeDecisional Diffie–Hellman assumptionfor a discussion of groups where the assumption is believed to hold.
ElGamal encryption is unconditionallymalleable,and therefore is not secure underchosen ciphertext attack.For example, given an encryptionof some (possibly unknown) message,one can easily construct a valid encryptionof the message.
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. TheCramer–Shoup cryptosystemis secure under chosen ciphertext attack assuming DDH holds for.Its proof does not use therandom oracle model.Another proposed scheme isDHIES,[4]whose proof requires an assumption that is stronger than the DDH assumption.
Efficiency
[edit]ElGamal encryption isprobabilistic,meaning that a singleplaintextcan 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 twoexponentiations;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.
See also
[edit]- Taher Elgamal,designer of this and other cryptosystems
- ElGamal signature scheme
- Homomorphic encryption
Further reading
[edit]- A. J. Menezes; P. C. van Oorschot; S. A. Vanstone."Chapter 8.4 ElGamal public-key encryption"(PDF).Handbook of Applied Cryptography.CRC Press.
- Dan Boneh(1998). "The Decision Diffie-Hellman problem".Algorithmic Number Theory.Lecture Notes in Computer Science. Vol. 1423. pp. 48–63.CiteSeerX10.1.1.461.9971.doi:10.1007/BFb0054851.ISBN978-3-540-64657-0.
References
[edit]- ^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.CiteSeerX10.1.1.476.4791.doi:10.1109/TIT.1985.1057074.S2CID2973271.(conference version appeared inCRYPTO'84, pp. 10–18)
- ^abMike Rosulek (2008-12-13)."Elgamal encryption scheme".University of Illinois at Urbana-Champaign.Archived fromthe originalon 2016-07-22.
- ^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.ISBN978-3-540-69105-1.
- ^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.ISBN978-3-540-41898-6.