�Introduction to Cryptology
21.10.2025
Lecture-6
Public-Key Cryptography
ElGamal Public-Key Crypto-System
Page : 1
bfolieq.drw
Lecture Outlines
Page : 2
bfolieq.drw
Y = E (Z,X)
Channel
Message
Sender
Receiver
Message
X
E ( Z,X )
D ( Z,Y )
X
The Target of Public Key Cryptography
Ciphering
De-Ciphering
Secret Key = Z
Z
Secret Key Channel
Z
Public-Key Register
drops out the need for secret key-
agreement completely
Page : 3
bfolieq.drw
ElGamal Crypto-System, 1985
Taher ElGamal: BsC, EE from Cairo University, � MsC and PhD Stanford University advisor M. Hellmann
ElGamal Cryptosystem became a NIST standard called DSA in 1994.
Basic idea: Multiplication instead of exponentiation
Taher ElGamal
Page : 4
bfolieq.drw
NIST standards are guidelines and frameworks developed by the National Institute of Standards and Technology (NIST), a U.S. government agency, to promote innovation, industrial competitiveness, and security. They include standards for measurement science, technology, and cybersecurity, such as the widely used Cybersecurity Framework, which helps organizations manage and reduce cyber risk. Businesses and government agencies use these standards for instrument calibration, data protection, and to ensure security and quality control
Page : 5
bfolieq.drw
ElGamal Crypto-System 1985
X
Z
M
M • Z =C
X
Z-1
M
Is that possible?: Yes,
By using groups arithmetic in in GF !
Basic idea: Multiplication instead of exponentiation
The inverse key Z-1 should not be computable if Z is known
Galois Field, a finite set of numbers where addition, subtraction, multiplication, and division (except by zero) are possible and follow specific rules
Page : 6
bfolieq.drw
ElGamal Crypto-System 1985
X
Z-1 = (αR) –x = α - X . R
M
That is possible by using arithmetic in GF(q) !
Basic idea: Multiplication instead of exponentiation for encryption
Z = yR = α x·R
R= Random secret generated ad-hoc by sender
X
M
C = M . α X . R
α R
y =α X
Secret Key = x
Open Key y=α X
Sender
Receiver
Public directory:
α primitive element in GF(q)
α -X . R
This is actually DH-key!
Page : 7
bfolieq.drw
ElGamal Secrecy-System (1985)
X
X
(yb)R
M
C = M . α Xb . R
M
α primitive element in GF(p)
Xa = secret key of A
α Xa
Xb = secret key of B
α Xb
r = α R
R
yb
(r)-Xb =α - Xb. R
Random Generator : R = 1 ... p-1
User A encrypts M to B
User B decrypts
ya = α Xa public key of A
yb = α Xb public key of B
α R
- Xb = (p-1) - Xb
Z-1 = α - Xb. R
Z = α Xb. R
/
m
/
m-bits
m = log2 p
r
C
Notice 2: The scheme applies similarly over GF(2m) , with α as a primitive element in GF(2m) .
Notice 1: a new R is needed for every M! Otherwise, Z can be easily revealed if M is known!
- Xb
Page : 8
bfolieq.drw
Example 1: Setup ElGamal Encryption System using GF(11). Send the message M=10 from user A to B. The secret key of B is6and for A is 7
X
X
(9)R
- Xb = -6
M=10
C = M .α Xb . R = 10 . 3 =8
M =32 mod 11 =10
α = 2 = primitive element in GF(11)
Xa = secret key of A=7
α 7 = 7
Xb =6= secret key of B
Yb=α Xb= 26 = 9
r =2 8 =3
R=8
yb
(3)-Xb = (3)4 =4
Random Generator : R = 1 ... p-1 ,
we select R= 8
User A sends M to B
User B receives
ya = α Xa public key of A = 7
yb = α Xb public key of B = 9
α R
-Xb = (11-1)-6 = 4
Z=9 8 = (2 6)8 = 248 mod 10 =28 =3
r=3
C=8
Solution :
Computing order of α =2: 22=4≠1, 23=8, 24=5, 25=10 ≠1, => order of 2 is 10 => 2 is a primitive element !.
p=11=2 . 5+1, Possible orders = divisors of p-1=2x5, that is 1,2,5,10.
(4)
Notice : If an attacker knows �one message, say M=10
The ecryption key Z can be revealed simply� as Z= M-1.C= 10-1.8 mod 11 =3
Page : 9
bfolieq.drw
ElGamal Crypto-System (1985)
for the same security
applications
Disadvantages
Advantages
than the plaintext (double)
every encrypted message
some applications
Page : 10
bfolieq.drw
ElGamal Signature Scheme
Signed Message
M
k -1 ( M - r . Xa ) mod (p-1) = S
Then M is authentic.
User A cannot deny �having signed message M
α is primitive in GF(p)
Xa = Secret Key of A
α Xa = ya
k
User A signs M
Verifier
ya = public key of A
k Random unit in Zp-1
That is: gcd (k, p-1 ) = 1
r = αk
M
S
r
α M = yar . r S mod p
If
public directory
p, α, ya
Page : 11
bfolieq.drw
Digital Signature Standard DSS (1994)
Explicit true signature based on ElGamal Signature System (1985)
Secure Hash Algorithm
(SHA) see later
M
H(M) 160 bits
Digital Signature Algorithm
(DSA)
Random
Source
160 bits 160 bits
( r , S )
Signature
M
k
Signed Message
Data digest (compression)
using Hash functions
Page : 12
bfolieq.drw
Digital Signature Algorithm DSA
Standardized (1994) Based on ElGamal Signature Scheme
Signed Message
M
or H(M)
k -1 ( H(M) + r . Xa ) in GF(q) = S
Then M is authentic
α is element in GF(p) with order q
where q = large prime (160 bits)
(q divides p-1 )
Xa = Secret Key of A
α Xa = ya
k
User A signs M
Verifier
ya = public key of A
k Random unit in GF(q)
For which gcd (q,k)=1 is valid
k = 1 to q-1 (160 bit)
Rq [ Rp(αk) ] = r
M
S
r
Rq(M . S -1 )
Rp[α . ya ] = U
Rq(r . S -1)
If
- p is a prime with 512 ... 1024 bits, q divides p-1 with a size of 160 bits,
- fresh k is required for every message!
public directory
p, q, α, ya
r = Rq( U )
160 bits
160 bits
Page : 13
bfolieq.drw
Example 2: 1. Sign the message M=6 by using the Digital Signature Algorithm DSA, Use GF(p)=GF(11).
2. Check the resulting electronic signature
Signed Message M=6
M = 6
or H(M)
k -1 ( M + r . Xa ) in GF(q)=3(6+4x3) mod 5=4 = S
This true, Thus M is authentic
α =3 is element in GF(p=11) with order q=5
where 5 = large prime
Xa = Secret Key of A =3
ya =3 3 = 5 in GF(11)
K=2
User A signs M
Verifier
ya = 5= public key of A
K=2 Random invertible mod (q=5)
K-1 = 3 (mod 5)
R5[ R11(32) ] = 4 = r
M=6
S=4
r=4
Rq(M . S -1 )
Rp[α . ya ] = U
Rq(r . S -1)
If
public directory
p, q, α, ya
Check if r = Rq( U )
4 = R5( 9 )
4 = 4
R5(6 . 4 )
U=R11[3 . 5 ] = 9
R5(4 . 4)
Solution:
Computing order of α =3: 32=9≠1, 33=5, 34=4, 35=1 => order of 3 is 5
P=11=2 . 5+1, Possible orders = divisors of p-1=2x5, that is 1,2,5,10. Select q=5
11, 5, 3, 5
Page : 14
bfolieq.drw
ElGamal Signature System (1985), DSS (1994)
less complex than verifier site
discrete logarithm problem which is� still seen as computationally� infeasible.
Disadvantages
Advantages
to sign every message
are needed
Page : 15
bfolieq.drw
Security of ElGamal Public Key Crypto-System
(Equivalent to DH system)
Security considerations and known facts:
The order of α (as a primitive element) is p-1 in GF(p) or 2m-1 in GF(2m). Therefore, p is selected as 1000 to 4000 bits prime or m> 1000.
Page : 16
bfolieq.drw
Hash Functions
Iterated Hash Function: generates a digest of the data after being sequentially processed through the so-called Hash function. In general as follows:
Hash
Mapping
Hi
Hi-1
H0 Initial value memory
xi
Input String
X = (x1 x2 ...xi .... xn)
Output H is the digest of Input X :
H = Hash(H0 , X)
Example: SHA (Secure Hash Algorithm) proposed as a standard with DSA
with N=160 bits (exposed to many attacks !) not more recommended !!!
N bits: size of hash value (digest)
Hash functions are needed to generate message digest
Non-linear
state machine
Page : 17
bfolieq.drw
Few Recommended
“Practical Hash Functions”
by deploying
“Block Ciphers”
Page : 18
bfolieq.drw
Hash Functions
Based on block ciphers
DM Scheme (Davis and Meyer)
Input String
X = (x1 x2 ...xi .... xn)
Digest of Input X is:
H = Hash(H0 , X)
BC: Block Cipher
KEY
Hi
Hi-1
Hi = Exi (Hi-1) ⊕ Hi-1
/ N
/
N
Cipher key length = Hash Block length = N
x
Y
Page : 19
bfolieq.drw
BC: Block Cipher
KEY
Cipher key length = 2 x Cipher block length N
Hash Functions
Based on block ciphers
LM Scheme (Lai and Massey 1992)
Input String
X = (x1 x2 ...xi .... xn)
Digest of Input X is:
H = E (H0 , X)
Hi
Hi-1
Hi = E (Hi-1)
/ N
/
N
Hi-1| xi
N /
Page : 20
bfolieq.drw
BC
Hi-1
Hi
xi
BC
g
Hi
xi
Hi-1
Davis-Meyer
Miyaguchi-Preneel
Traditional Hash Functions
Based on deploying block ciphers (BC)
(well known constellations. See NIST standards)
BC: Block Cipher
state
BC
g
Hi-1
Hi
xi
Matyas-Meyer-Oseas
g: key size adapter
X
Y
key
Page : 21
bfolieq.drw
Block-Cipher based Hash Functions alternatives 1/2
Source: Handbook of Applied Cryptography
by Alfred J. Menezes, Paul C. Van Oorschot, Scott A. Vanstone, CRC Press (October 16, 1996) (available free of charge on the WEB)
Page : 22
bfolieq.drw
Block-Cipher based Hash Functions alternatives 2/2
Source: Handbook of Applied Cryptography
by Alfred J. Menezes, Paul C. Van Oorschot, Scott A. Vanstone, CRC Press (October 16, 1996) (available free of charge on the WEB)
Page : 23
bfolieq.drw