9 ElGamal Method

  • Upload
    kewan23

  • View
    223

  • Download
    0

Embed Size (px)

Citation preview

  • 8/12/2019 9 ElGamal Method

    1/14

    1Data Security

    ElGam

    alCryptos

    ystem

    BySafar M. Asaad

    Lecture 7 4thYear

  • 8/12/2019 9 ElGamal Method

    2/14

    2Data Security

    Outlines

    ! An introduction to ElGamal Cryptosystem.! ElGamal Key generation! ElGamal encryption! ElGamal decryption

    !ElGamal encryption and decryption examples.

    ! Home Work.! Summary! References.

  • 8/12/2019 9 ElGamal Method

    3/14

    3Data 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.

  • 8/12/2019 9 ElGamal Method

    4/14

    4Data Security

    ElGamal Key generation

    ! Choose a large prime p." pmust be large enough to hide the message.

    ! Generate a special numberg.! The number gmust be between 1 and p 1, of the Group Z*p.

    "The number gmust 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 yfrom x,pand g"

    The public key yis graised to the power of the private keyxmodulop. In other words:

    y = gxmod p

  • 8/12/2019 9 ElGamal Method

    5/14

    5Data Security

    ElGamal Key generation: Example! Letp= 23! Select a primitive element g= 11! Choose a private key x= 6! Compute y= 116(mod 23)! = 9

    ! Public key is 9! Private key is 6

  • 8/12/2019 9 ElGamal Method

    6/14

    6Data 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 mshe takes the following steps:1. She generates a random number kbetween 1 and p-1.2. Compute two values C1and C2, where

    C1= gkmod p, and C2= My

    kmod p

    3. Send the ciphertext C, which consists of the two separatevalues C1 and C2. The cipher text is represented as a pair

    (C1,C2).

  • 8/12/2019 9 ElGamal Method

    7/14

    7Data Security

    ElGamal encryption: Example! To encrypt M = 10 using Public key 9

    1. Generate a random number k = 3.2. Compute:

    " C1= 113mod 23 = 20" C2= 10 x 93mod 23

    = 10 x 16 = 160 mod 23 = 22

    3. Ciphertext C = (20 , 22 )! Do the same steps for the remaining blocks.

  • 8/12/2019 9 ElGamal Method

    8/14

    8Data Security

    ElGamal decryption! C1= gkmod p C2= Mykmod p

    1. The receiver begins by using their private key x totransform C1into something more useful:

    C1x= (gk)xmod p

    NOTE: C1x= (gk)x= (gx)k= (y)k= ykmod p

    2. This is a very useful quantity because if you divide C2by ityou get M. In other words:

    C2/ yk

    = (Myk

    ) / yk

    = M mod p

  • 8/12/2019 9 ElGamal Method

    9/14

    9Data Security

    ElGamal decryption: Example

    ! To decrypt C = (20 , 22 )1. Compute 206= 16 mod 232. Compute 22 / 16 = 10 mod 233. Plaintext = 10

    ! Note:! C1x= ykmod p.! C2/ yk= M mod p.

    !

  • 8/12/2019 9 ElGamal Method

    10/14

    10Data Security

    ElGamals Security

    ! The ElGamel public key cryptosystem is based upon the difficultyof solving the discrete logarithm problem (DLP) which is as

    follows:

    ! Given a prime p and values g and y, find x such thaty = gxmod p

    ! For a small value of p, it is easy to solve a DLP by trial and erroror exhaustive search.

    ! For example, given p = 11, g = 2 and y = 9, we can try differentvalues of x until we reach the correct solution for 2x mod 11 = 9.

    ! However, for a large value of p, i.e., if p has around 100 decimaldigits, then it is not possible to solve a DLP using current

    technology.

  • 8/12/2019 9 ElGamal Method

    11/14

    11Data Security

    Comparing RSA and ElGamel

    RSA

    ! Secur i ty based on thedifficulty of the factorisation

    problem.

    ! The ciphertext is just onevalue 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 ddecryption algorithms are the

    s a m e ( m o d u l a r

    exponentiation).

    El Gamel

    ! Security based on thedifficulty of the discrete log

    problem.

    ! The ciphertext is two valuesc 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 ddecryption algorithms are

    different (although both takeabout the same time to

    perform).

  • 8/12/2019 9 ElGamal Method

    12/14

    12Data Security

    Home Work

    ! What is Steganography?! Uses of Steganography?! Its Relation to Cryptography?! What are the types of Steganography?

  • 8/12/2019 9 ElGamal Method

    13/14

    13Data Security

    Summary

    We have covered:! An introduction to ElGamal Cryptosystem.

    ! ElGamal Key generation with example.! ElGamal encryption and decryption.

    ! ElGamal encryption and decryption examples.

  • 8/12/2019 9 ElGamal Method

    14/14

    14Data Security

    References

    " William Stallings, Cryptography and Network Security, 3rdEdition, Prentice Hall, 2003.

    " Behrouz Forouzan, Cryptography and Network Security.McGraw Hill.

    "Kaufman, Perlman and Speciner, Network Security: PrivateCommunication in a Public World. Pearson - Prentice Hall.

    " Lecture notes, Dr Keith Martin, Introduction to Cryptographyand Security Mechanisms