In
cryptography
Cryptography, or cryptology (from grc, , translit=kryptós "hidden, secret"; and ''graphein'', "to write", or ''-logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of adver ...
, the ElGamal encryption system is an
asymmetric key encryption algorithm
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 al ...
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
Diffie–Hellman key exchangeSynonyms of Diffie–Hellman key exchange include:
* Diffie–Hellman–Merkle key exchange
* Diffie–Hellman key agreement
* Diffie–Hellman key establishment
* Diffie–Hellman key negotiation
* Exponential key exc ...
. It was described by
Taher Elgamal
Taher Elgamal (Arabic: طاهر الجمل) (born 18 August 1955) is an Egyptian cryptographer and entrepreneur. He has served as the Chief Technology Officer (CTO) of Security at Salesforce since 2013. Prior to that, he was the founder and CEO ...
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 PGP cryptographic software suite. The software is compliant with RFC 4880, the IETF standards-track specification of OpenPGP. Modern versions of PGP are interoperable ...
software, recent versions of
PGP
PGP or Pgp may refer to:
Science and technology
* P-glycoprotein, a type of protein
* Pelvic girdle pain, a pregnancy discomfort
* Personal Genome Project, to sequence genomes and medical records
* Pretty Good Privacy, a computer program for the ...
, 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 for ...
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 signature ...
, which should not be confused with ElGamal encryption.
ElGamal encryption can be defined over any
cyclic group , like
multiplicative group of integers modulo ''n''. Its security depends upon the difficulty of a certain problem in
related to computing
discrete logarithm
In mathematics, for given real numbers ''a'' and ''b'', the logarithm log''b'' ''a'' is a number ''x'' such that . Analogously, in any group ''G'', powers ''b'k'' can be defined for all integers ''k'', and the discrete logarithm log''b' ...
s.
The algorithm
ElGamal encryption consists of three components: the key generator, the encryption algorithm, and the decryption algorithm.
Key generation
The first party, Alice, generates a key pair as follows:
* Generate an efficient description of a
cyclic group of
order
Order, ORDER or Orders may refer to:
* Categorization, the process in which ideas and objects are recognized, differentiated, and understood
* Heterarchy, a system of organization wherein the elements have the potential to be ranked a number of d ...
with
generator
Generator may refer to:
* Signal generator, electronic devices that generate repeating or non-repeating electronic signals
* Electric generator, a device that converts mechanical energy to electrical energy.
* Generator (circuit theory), an eleme ...
. Let
represent the identity element of
.
* Choose an integer
randomly from
.
* Compute
.
* The
public key consists of the values
. Alice publishes this public key and retains
as her private key, which must be kept secret.
Encryption
A second party, Bob, encrypts a message
to Alice under her public key
as follows:
* Map the message
to an element
of
using a reversible mapping function.
* Choose an integer
randomly from
.
* Compute
. This is called the ''shared secret''.
* Compute
.
* Compute
.
* Bob sends the ciphertext
to Alice.
Note that if one knows both the ciphertext
and the plaintext
, one can easily find the shared secret
, since
. Therefore, a new
and hence a new
is generated for every message to improve security. For this reason,
is also called an
ephemeral key
A cryptographic key is called ephemeral if it is generated for each execution of a key establishment process. In some cases ephemeral keys are used more than once, within a single session (e.g., in broadcast applications) where the sender generate ...
.
Decryption
Alice decrypts a ciphertext
with her private key
as follows:
* Compute
. Since
,
, and thus it is the same shared secret that was used by Bob in encryption.
* Compute
, the inverse of
in the group
. This can be computed in one of several ways. If
is a subgroup of a multiplicative group of integers modulo
, where
is prime, the
modular multiplicative inverse 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 ide ...
. An alternative is to compute
as
. This is the inverse of
because of
Lagrange's theorem, since
.
* Compute
. This calculation produces the original message
, because
; hence
.
* Map
back to the plaintext message
.
Practical use
Like most public key systems, the ElGamal cryptosystem is usually used as part of a
hybrid cryptosystem In cryptography, a hybrid cryptosystem is one which combines the convenience of a public-key cryptosystem with the efficiency of a symmetric-key cryptosystem. Public-key cryptosystems are convenient in that they do not require the sender and receiv ...
, 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
In cryptography, security level is a measure of the strength that a cryptographic primitive — such as a cipher or hash function — achieves. Security level is usually expressed as a number of "bits of security" (also security strength ...
, 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
as well as any padding scheme used on the messages. If the
computational Diffie–Hellman assumption The computational Diffie–Hellman (CDH) assumption is a computational hardness assumption about the Diffie–Hellman problem.
The CDH assumption involves the problem of computing the discrete logarithm in cyclic groups. The CDH problem illustrates ...
(CDH) holds in the underlying cyclic group
, then the encryption function is
one-way
One-way or one way may refer to:
*One-way traffic, a street either facilitating only one-way traffic, or designed to direct vehicles to move in one direction
*One-way travel, a trip that does not return to its origin
Music
*One Way (American ban ...
.
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
, 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 ciph ...
.
[
] 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, and therefore is not secure under chosen ciphertext attack
A chosen-ciphertext attack (CCA) is an attack model for cryptanalysis where the cryptanalyst can gather information by obtaining the decryptions of chosen ciphertexts. From these pieces of information the adversary can attempt to recover the hidd ...
. For example, given an encryption of some (possibly unknown) message , one can easily construct a valid encryption of 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. 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 computation ...
is secure under chosen ciphertext attack assuming DDH holds for . 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 time t ...
. Another proposed scheme is DHAES, whose proof requires an assumption that is weaker than the DDH assumption.
Efficiency
ElGamal encryption is probabilistic
Probability is the branch of mathematics concerning numerical descriptions of how likely an Event (probability theory), event is to occur, or how likely it is that a proposition is true. The probability of an event is a number between 0 and ...
, 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
Exponentiation is a mathematical operation, written as , involving two numbers, the '' base'' and the ''exponent'' or ''power'' , and pronounced as " (raised) to the (power of) ". When is a positive integer, exponentiation corresponds to re ...
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
Taher Elgamal (Arabic: طاهر الجمل) (born 18 August 1955) is an Egyptian cryptographer and entrepreneur. He has served as the Chief Technology Officer (CTO) of Security at Salesforce since 2013. Prior to that, he was the founder and CEO ...
, 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 signature ...
* Homomorphic encryption
Homomorphic encryption is a form of encryption that permits users to perform computations on its encrypted data without first decrypting it. These resulting computations are left in an encrypted form which, when decrypted, result in an identical ...
Further reading
*
*
References
{{DEFAULTSORT:Elgamal Encryption
Public-key encryption schemes