Você está na página 1de 14

1

Data Security
E
l
G
a
m
a
l

C
r
y
p
t
o
s
y
s
t
e
m

By
Safar M. Asaad
Lecture 7 4
th
Year
2
Data Security
Outlines
! An introduction to ElGamal Cryptosystem.
! ElGamal Key generation
! ElGamal encryption
! ElGamal decryption
! ElGamal encryption and decryption examples.
! Home Work.
! Summary
! References.

3
Data Security
ElGamal Method
! In 1984, Taher ElGamal introduced the concept of ElGamal
Encryption.
! Asymmetric key encryption algorithm.
! We will also take a look at the ElGamal public key cipher
system for a number of reasons:
o To show that RSA is not the only one public key system.
o To exhibit a public key system based on a different one way
function.
4
Data Security
ElGamal Key generation
! Choose a large prime p.
" p must be large enough to hide the message.
! Generate a special number g.
! The number g must be between 1 and p 1, of the Group Z
*
p
.
" The number g must be a primitive element modulo p.
! Choose a private key x.
" This can be any number bigger than 1 and smaller than p-2
! Compute public key y from x, p and g
" The public key y is g raised to the power of the private key
x modulo p. In other words:
y = g
x
mod p

5
Data Security
ElGamal Key generation: Example
! Let p = 23
! Select a primitive element g = 11
! Choose a private key x = 6
! Compute y = 11
6
(mod 23)
! = 9

! Public key is 9
! Private key is 6
6
Data Security
ElGamal encryption
! After receiving the Public key by the message sender as triplet
(p, g, y).
! The first job is to represent the plaintext as a series of numbers
(m) modulo p.
! Then for each message block m she takes the following steps:
1. She generates a random number k between 1 and p-1.
2. Compute two values C
1
and C
2
, where
C
1
= g
k
mod p, and C
2
= My
k
mod p
3. Send the ciphertext C, which consists of the two separate
values C
1
and C
2
. The cipher text is represented as a pair
(C
1
,C
2
).
7
Data Security
ElGamal encryption: Example
! To encrypt M = 10 using Public key 9
1. Generate a random number k = 3.
2. Compute:
" C1= 11
3
mod 23 = 20
" C2= 10 x 9
3
mod 23
= 10 x 16 = 160 mod 23 = 22
3. Ciphertext C = (20 , 22 )
! Do the same steps for the remaining blocks.
8
Data Security
ElGamal decryption
! C
1
= g
k
mod p C
2
= My
k
mod p
1. The receiver begins by using their private key x to
transform C
1
into something more useful:
C
1
x
= (g
k
)
x
mod p
NOTE: C
1
x
= (g
k
)
x
= (g
x
)
k
= (y)
k
= y
k
mod p
2. This is a very useful quantity because if you divide C
2
by it
you get M. In other words:
C
2
/ y
k
= (My
k
) / y
k
= M mod p
9
Data Security
ElGamal decryption: Example
! To decrypt C = (20 , 22 )
1. Compute 20
6
= 16 mod 23
2. Compute 22 / 16 = 10 mod 23
3. Plaintext = 10

! Note:
! C
1
x
= y
k
mod p.
! C
2
/ y
k
= M mod p.
!
10
Data Security
ElGamals Security
! The ElGamel public key cryptosystem is based upon the difficulty
of solving the discrete logarithm problem (DLP) which is as
follows:
! Given a prime p and values g and y, find x such that
y = g
x
mod p
! For a small value of p, it is easy to solve a DLP by trial and error
or exhaustive search.
! For example, given p = 11, g = 2 and y = 9, we can try different
values of x until we reach the correct solution for 2
x
mod 11 = 9.
! However, for a large value of p, i.e., if p has around 100 decimal
digits, then it is not possible to solve a DLP using current
technology.

11
Data Security
Comparing RSA and ElGamel
RSA
! Secur i t y based on t he
difficulty of the factorisation
problem.
! The ciphertext is just one
value c which is roughly the
same size as the message m.
! T h e e n c r y p t i o n a n d
decryption algorithms are the
s a m e ( m o d u l a r
exponentiation).
El Gamel
! Securi t y based on t he
difficulty of the discrete log
problem.
! The ciphertext is two values
c and r and so is twice the
size of the message m.
! T h e e n c r y p t i o n a n d
decryption algorithms are
different (although both take
about the same time to
perform).

12
Data Security
Home Work
! What is Steganography?
! Uses of Steganography?
! Its Relation to Cryptography?
! What are the types of Steganography?
13
Data Security
Summary
We have covered:
! An introduction to ElGamal Cryptosystem.
! ElGamal Key generation with example.
! ElGamal encryption and decryption.
! ElGamal encryption and decryption examples.

14
Data Security
References
" William Stallings, Cryptography and Network Security, 3rd
Edition, Prentice Hall, 2003.
" Behrouz Forouzan, Cryptography and Network Security.
McGraw Hill.
" Kaufman, Perlman and Speciner, Network Security: Private
Communication in a Public World. Pearson - Prentice Hall.
" Lecture notes, Dr Keith Martin, Introduction to Cryptography
and Security Mechanisms

Você também pode gostar