ElGamal signature scheme

Digital 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.[1]

The ElGamal signature algorithm is rarely used in practice. A variant developed at the NSA and known as the Digital Signature Algorithm is much more widely used. There are several other variants.[2] The ElGamal signature scheme must not be confused with ElGamal encryption which was also invented by Taher Elgamal.

## Overview[edit]

The ElGamal signature scheme is a digital signature scheme based on the algebraic properties of modular exponentiation, together with the discrete logarithm problem. The algorithm uses a key pair consisting of a public key and a private key. The private key is used to generate a digital signature for a message, and such a signature can be verified by using the signer's corresponding public key. The digital signature provides message authentication (the receiver can verify the origin of the message), integrity (the receiver can verify that the message has not been modified since it was signed) and non-repudiation (the sender cannot falsely claim that they have not signed the message).

## History[edit]

The ElGamal signature scheme was described by Taher Elgamal in 1985.[1] It is based on the Diffie–Hellman problem.

## Operation[edit]

The scheme involves four operations: key generation (which creates the key pair), key distribution, signing and signature verification.

### Key generation[edit]

Key generation has two phases. The first phase is a choice of algorithm parameters which may be shared between different users of the system, while the second phase computes a single key pair for one user.

#### Parameter generation[edit]

* Choose a key length  N {\displaystyle N} .
* Choose a  N {\displaystyle N} -bit prime number p {\displaystyle p}
* Choose a cryptographic hash function H {\displaystyle H} with output length  L {\displaystyle L} bits. If  L > N {\displaystyle L>N} , only the leftmost  N {\displaystyle N} bits of the hash output are used.
* Choose a generator g < p {\displaystyle g<p} of the multiplicative group of integers modulo p,  Z p ∗ {\displaystyle Z_{p}^{*}} .

The algorithm parameters are  ( p , g ) {\displaystyle (p,g)} . These parameters may be shared between users of the system.

#### Per-user keys[edit]

Given a set of parameters, the second phase computes the key pair for a single user:

* Choose an integer  x {\displaystyle x} randomly from  { 1 … p − 2 } {\displaystyle \\{1\ldots p-2\\}} .
* Compute  y := g x mod p {\displaystyle y:=g^{x}{\bmod {p}}} .

x {\displaystyle x} is the private key and  y {\displaystyle y} is the public key.

### Key distribution[edit]

The signer should send the public key  y {\displaystyle y} to the receiver via a reliable, but not necessarily secret, mechanism. The signer should keep the private key  x {\displaystyle x} secret.

### Signing[edit]

A message  m {\displaystyle m} is signed as follows:

* Choose an integer  k {\displaystyle k} randomly from  { 2 … p − 2 } {\displaystyle \\{2\ldots p-2\\}} with  k {\displaystyle k} relatively prime to  p − 1 {\displaystyle p-1} .
* Compute  r := g k mod p {\displaystyle r:=g^{k}{\bmod {p}}} .
* Compute  s := ( H ( m ) − x r ) k − 1 mod ( p − 1 ) {\displaystyle s:=(H(m)-xr)k^{-1}{\bmod {(}}p-1)} .
* In the unlikely event that  s = 0 {\displaystyle s=0} start again with a different random  k {\displaystyle k} .

The signature is  ( r , s ) {\displaystyle (r,s)} .

### Verifying a signature[edit]

One can verify that a signature  ( r , s ) {\displaystyle (r,s)} is a valid signature for a message  m {\displaystyle m} as follows:

* Verify that  0 < r < p {\displaystyle 0<r<p} and  0 < s < p − 1 {\displaystyle 0<s<p-1} .
* The signature is valid if and only if  g H ( m ) ≡ y r r s ( mod p ) . {\displaystyle g^{H(m)}\equiv y^{r}r^{s}{\pmod {p}}.}

## Correctness[edit]

The algorithm is correct in the sense that a signature generated with the signing algorithm will always be accepted by the verifier.

The computation of  s {\displaystyle s} during signature generation implies

H ( m ) ≡ x r + s k ( mod p − 1 ) . {\displaystyle H(m)\,\equiv \,xr+sk{\pmod {p-1}}.}

Since  g {\displaystyle g} is relatively prime to  p {\displaystyle p} ,

g H ( m ) ≡ g x r + s k ( mod p ) ≡ ( g x ) r ( g k ) s ( mod p ) ≡ ( y ) r ( r ) s ( mod p ) . {\displaystyle {\begin{aligned}g^{H(m)}&\equiv g^{xr+sk}{\pmod {p}}\\\&\equiv (g^{x})^{r}(g^{k})^{s}{\pmod {p}}\\\&\equiv (y)^{r}(r)^{s}{\pmod {p}}.\\\\\end{aligned}}}

## Security[edit]

A third party can forge signatures either by finding the signer's secret key x or by finding collisions in the hash function  H ( m ) ≡ H ( M ) ( mod p − 1 ) {\displaystyle H(m)\equiv H(M){\pmod {p-1}}} . Both problems are believed to be difficult. However, as of 2011 no tight reduction to a computational hardness assumption is known.

The signer must be careful to choose a different k uniformly at random for each signature and to be certain that k, or even partial information about k, is not leaked. Otherwise, an attacker may be able to deduce the secret key x with reduced difficulty, perhaps enough to allow a practical attack. In particular, if two messages are sent using the same value of k and the same key, then an attacker can compute x directly.[1]

### Existential forgery[edit]

The original paper[1] did not include a hash function as a system parameter. The message m was used directly in the algorithm instead of H(m). This enables an attack called existential forgery, as described in section IV of the paper. Pointcheval and Stern generalized that case and described two levels of forgeries:[3]

1. The one-parameter forgery. Select an  e {\displaystyle e} such that  1 < e < p − 1 {\displaystyle 1<e<p-1} . Set  r := g e y mod p {\displaystyle r:=g^{e}y{\bmod {p}}} and  s := − r mod ( p − 1 ) {\displaystyle s:=-r{\bmod {(p-1)}}} . Then the tuple  ( r , s ) {\displaystyle (r,s)} is a valid signature for the message  m = e s mod ( p − 1 ) {\displaystyle m=es{\bmod {(p-1)}}} .
2. The two-parameters forgery. Select  1 < e , v < p − 1 {\displaystyle 1<e,v<p-1} , and  gcd ( v , p − 1 ) = 1 {\displaystyle \gcd(v,p-1)=1} . Set  r := g e y v mod p {\displaystyle r:=g^{e}y^{v}{\bmod {p}}} and  s := − r v − 1 mod ( p − 1 ) {\displaystyle s:=-rv^{-1}{\bmod {(p-1)}}} . Then the tuple  ( r , s ) {\displaystyle (r,s)} is a valid signature for the message  m = e s mod ( p − 1 ) {\displaystyle m=es{\bmod {(p-1)}}} . The one-parameter forgery is a special case of the two-parameter forgery, when  v = 1 {\displaystyle v=1} .

## See also[edit]

* Modular arithmetic
* Digital Signature Algorithm
* Elliptic Curve Digital Signature Algorithm
* ElGamal encryption
* Schnorr signature
* Pointcheval–Stern signature algorithm

## References[edit]

1. ^ a b c d 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. ^ K. Nyberg, R. A. Rueppel (1996). "Message recovery for signature schemes based on the discrete logarithm problem". Designs, Codes and Cryptography. 7 (1–2): 61–81. doi:10.1007/BF00125076. S2CID 123533321.
3. ^ Pointcheval, David; Stern, Jacques (2000). "Security Arguments for Digital Signatures and Blind Signatures" (PDF). J Cryptology. 13 (3): 361–396. CiteSeerX 10.1.1.208.8352. doi:10.1007/s001450010003. S2CID 1912537. Archived from the original (PDF) on 2021-04-22. Retrieved 2019-08-17.

* v
* t
* e

Public-key cryptography

Algorithms|

| Integer factorization|

* Benaloh
* Blum–Goldwasser
* Cayley–Purser
* Damgård–Jurik
* GMR
* Goldwasser–Micali
* Naccache–Stern
* Paillier
* Rabin
* RSA
* Okamoto–Uchiyama
* Schmidt–Samoa

|

Discrete logarithm|

* BLS
* Cramer–Shoup
* DH
* DSA
* ECDH
* X25519
* X448
* ECDSA
* EdDSA
* Ed25519
* Ed448
* ECMQV
* EKE
* ElGamal
* signature scheme
* MQV
* Schnorr
* SPEKE
* SRP
* STS

Lattice/SVP/CVP/LWE/SIS|

* BLISS
* Kyber
* NewHope
* NTRUEncrypt
* NTRUSign
* RLWE-KEX
* RLWE-SIG

Others|

* AE
* CEILIDH
* EPOC
* HFE
* IES
* Lamport
* McEliece
* Merkle–Hellman
* Naccache–Stern knapsack cryptosystem
* Three-pass protocol
* XTR

Theory|

* Discrete logarithm cryptography
* Elliptic-curve cryptography
* Hash-based cryptography
* Non-commutative cryptography
* RSA problem
* Trapdoor function

Standardization|

* CRYPTREC
* IEEE P1363
* NESSIE
* NSA Suite B
* Post-Quantum Cryptography

Topics|

* Digital signature
* OAEP
* Fingerprint
* PKI
* Web of trust
* Key size
* Identity-based cryptography
* Post-quantum cryptography
* OpenPGP card

* v
* t
* e

Cryptography

General|

* History of cryptography
* Outline of cryptography
* Cryptographic protocol
* Authentication protocol
* Cryptographic primitive
* Cryptanalysis
* Cryptocurrency
* Cryptosystem
* Cryptographic nonce
* Cryptovirology
* Hash function
* Cryptographic hash function
* Key derivation function
* Digital signature
* Kleptography
* Key (cryptography)
* Key exchange
* Key generator
* Key schedule
* Key stretching
* Keygen
* Cryptojacking malware
* Ransomware
* Random number generation
* Cryptographically secure pseudorandom number generator (CSPRNG)
* Pseudorandom noise (PRN)
* Secure channel
* Insecure channel
* Subliminal channel
* Encryption
* Decryption
* End-to-end encryption
* Harvest now, decrypt later
* Information-theoretic security
* Plaintext
* Codetext
* Ciphertext
* Shared secret
* Trapdoor function
* Trusted timestamping
* Key-based routing
* Onion routing
* Garlic routing
* Kademlia
* Mix network

Mathematics|

* Cryptographic hash function
* Block cipher
* Stream cipher
* Symmetric-key algorithm
* Authenticated encryption
* Public-key cryptography
* Quantum key distribution
* Quantum cryptography
* Post-quantum cryptography
* Message authentication code
* Random numbers
* Steganography

* Category

*[v]: View this template
*[t]: Discuss this template
*[e]: Edit this template