ElGamal Encryption
   HOME

TheInfoList



OR:

In
cryptography Cryptography, or cryptology (from "hidden, secret"; and ''graphein'', "to write", or ''-logy, -logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of Adversary (cryptography), ...
, the ElGamal encryption system is an asymmetric key encryption algorithm for
public-key cryptography Public-key cryptography, or asymmetric cryptography, is the field of cryptographic systems that use pairs of related keys. Each key pair consists of a public key and a corresponding private key. Key pairs are generated with cryptographic alg ...
which is based on the Diffie–Hellman key exchange. It was described by Taher Elgamal in 1985. ElGamal encryption is used in the free
GNU Privacy Guard GNU Privacy Guard (GnuPG or GPG) is a free-software replacement for Symantec's cryptographic software suite PGP. The software is compliant with the now obsoleted , the IETF standards-track specification of OpenPGP. Modern versions of PGP are ...
software, recent versions of PGP, and other
cryptosystem In cryptography, a cryptosystem is a suite of cryptographic algorithms needed to implement a particular security service, such as confidentiality (encryption). Typically, a cryptosystem consists of three algorithms: one for key generation, one ...
s. The
Digital Signature Algorithm The Digital Signature Algorithm (DSA) is a Public-key cryptography, public-key cryptosystem and Federal Information Processing Standards, Federal Information Processing Standard for digital signatures, based on the mathematical concept of modular e ...
(DSA) is a variant of the
ElGamal signature scheme The ElGamal signature scheme is a digital signature scheme which is based on the difficulty of computing discrete logarithms. It was described by Taher Elgamal in 1985. (conference version appeared in CRYPTO'84, pp. 10–18) The ElGamal signatu ...
, which should not be confused with ElGamal encryption. ElGamal encryption can be defined over any
cyclic group In abstract algebra, a cyclic group or monogenous group is a Group (mathematics), group, denoted C_n (also frequently \Z_n or Z_n, not to be confused with the commutative ring of P-adic number, -adic numbers), that is Generating set of a group, ge ...
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 . Its security depends upon the difficulty of the Decisional Diffie Hellman Problem in G.


The algorithm

The algorithm can be described as first performing a Diffie–Hellman key exchange to establish a shared secret s, then using this as a
one-time pad The one-time pad (OTP) is an encryption technique that cannot be Cryptanalysis, cracked in cryptography. It requires the use of a single-use pre-shared key that is larger than or equal to the size of the message being sent. In this technique, ...
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.


Key generation

The first party, Alice, generates a key pair as follows: * Generate an efficient description of a
cyclic group In abstract algebra, a cyclic group or monogenous group is a Group (mathematics), group, denoted C_n (also frequently \Z_n or Z_n, not to be confused with the commutative ring of P-adic number, -adic numbers), that is Generating set of a group, ge ...
G\, of order q\, with generator g. Let e represent the identity element of G. *: 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 integer x randomly from \. * Compute h := g^x. * The
public key Public-key cryptography, or asymmetric cryptography, is the field of cryptographic systems that use pairs of related keys. Each key pair consists of a public key and a corresponding private key. Key pairs are generated with cryptographic alg ...
consists of the values (G,q,g,h). Alice publishes this public key and retains x as her private key, which must be kept secret.


Encryption

A second party, Bob, encrypts a message M to Alice under her public key (G,q,g,h) as follows: * Map the message M to an element m of G using a reversible mapping function. * Choose an integer y randomly from \. * Compute s := h^y. This is called the ''shared secret''. * Compute c_1 := g^y. * Compute c_2 := m \cdot s. * Bob sends the ciphertext (c_1,c_2) to Alice. Note that if one knows both the ciphertext (c_1,c_2) and the plaintext m, one can easily find the shared secret s, since c_2 \cdot m^ = s. Therefore, a new y and hence a new s is generated for every message to improve security. For this reason, y is also called an ephemeral key.


Decryption

Alice decrypts a ciphertext (c_1, c_2) with her private key x as follows: * Compute s := c_1^x. Since c_1 = g^y, c_1^x = g^ = h^y, and thus it is the same shared secret that was used by Bob in encryption. * Compute s^, the inverse of s in the group G. This can be computed in one of several ways. If G is a subgroup of a multiplicative group of integers modulo n, where n is prime, the
modular multiplicative inverse In mathematics, particularly in the area of arithmetic, a modular multiplicative inverse of an integer is an integer such that the product is congruent to 1 with respect to the modulus .. In the standard notation of modular arithmetic this cong ...
can be computed using the
extended Euclidean algorithm In arithmetic and computer programming, the extended Euclidean algorithm is an extension to the Euclidean algorithm, and computes, in addition to the greatest common divisor (gcd) of integers ''a'' and ''b'', also the coefficients of Bézout's id ...
. An alternative is to compute s^ as c_1^. This is the inverse of s because of Lagrange's theorem, since s \cdot c_1^ = g^ \cdot g^ = (g^)^y = e^y = e. * Compute m := c_2 \cdot s^. This calculation produces the original message m, because c_2 = m \cdot s; hence c_2 \cdot s^ = (m \cdot s) \cdot s^ = m \cdot e = m. * Map m back to the plaintext message M.


Practical use

Like most public key systems, the ElGamal cryptosystem is usually used as part of a
hybrid cryptosystem Hybrid may refer to: Science * Hybrid (biology), an offspring resulting from cross-breeding ** Hybrid grape, grape varieties produced by cross-breeding two ''Vitis'' species ** Hybridity, the property of a hybrid plant which is a union of two diff ...
, 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.


Security

The security of the ElGamal scheme depends on the properties of the underlying group G as well as any padding scheme used on the messages. If the
computational Diffie–Hellman assumption A computation is any type of arithmetic or non-arithmetic calculation that is well-defined. Common examples of computation are mathematical equation solving and the execution of computer algorithms. Mechanical or electronic devices (or, historic ...
(CDH) holds in the underlying cyclic group G, then the encryption function is one-way. If the
decisional Diffie–Hellman assumption The decisional Diffie–Hellman (DDH) assumption is a computational hardness assumption about a certain problem involving discrete logarithms in cyclic groups. It is used as the basis to prove the security of many cryptographic protocols, most notab ...
(DDH) holds in G, then ElGamal achieves
semantic security In cryptography, a semantically secure cryptosystem is one where only negligible information about the plaintext can be feasibly extracted from the ciphertext. Specifically, any probabilistic, polynomial-time algorithm (PPTA) that is given the ci ...
. Semantic security is not implied by the computational Diffie–Hellman assumption alone. See
Decisional Diffie–Hellman assumption The decisional Diffie–Hellman (DDH) assumption is a computational hardness assumption about a certain problem involving discrete logarithms in cyclic groups. It is used as the basis to prove the security of many cryptographic protocols, most notab ...
for a discussion of groups where the assumption is believed to hold. ElGamal encryption is unconditionally
malleable Ductility refers to the ability of a material to sustain significant plastic deformation before fracture. Plastic deformation is the permanent distortion of a material under applied stress, as opposed to elastic deformation, which is reversi ...
, and therefore is not secure under chosen ciphertext attack. For example, given an encryption (c_1, c_2) of some (possibly unknown) message m, one can easily construct a valid encryption (c_1, 2 c_2) of the message 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 The Cramer–Shoup system is an asymmetric key encryption algorithm, and was the first efficient scheme proven to be secure against adaptive chosen ciphertext attack using standard cryptographic assumptions. Its security is based on the computatio ...
is secure under chosen ciphertext attack assuming DDH holds for G. Its proof does not use the
random oracle model In cryptography, a random oracle is an oracle (a theoretical black box) that responds to every ''unique query'' with a (truly) random response chosen uniformly from its output domain. If a query is repeated, it responds the same way every tim ...
. Another proposed scheme is DHIES, whose proof requires an assumption that is stronger than the DDH assumption.


Efficiency

ElGamal encryption is probabilistic, meaning that a single
plaintext In cryptography, plaintext usually means unencrypted information pending input into cryptographic algorithms, usually encryption algorithms. This usually refers to data that is transmitted or stored unencrypted. Overview With the advent of comp ...
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
exponentiation In mathematics, exponentiation, denoted , is an operation (mathematics), operation involving two numbers: the ''base'', , and the ''exponent'' or ''power'', . When is a positive integer, exponentiation corresponds to repeated multiplication ...
s; 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

* Taher Elgamal, designer of this and other cryptosystems *
ElGamal signature scheme The ElGamal signature scheme is a digital signature scheme which is based on the difficulty of computing discrete logarithms. It was described by Taher Elgamal in 1985. (conference version appeared in CRYPTO'84, pp. 10–18) The ElGamal signatu ...
*
Homomorphic encryption Homomorphic encryption is a form of encryption that allows computations to be performed on encrypted data without first having to decrypt it. The resulting computations are left in an encrypted form which, when decrypted, result in an output th ...


Further reading

* *


References

{{DEFAULTSORT:Elgamal Encryption Public-key encryption schemes