LAB 8 CPIT 425 Prepared by: Mohammed Ghazi Al-Obeidallah
Information Security CPIT 425
LAB 8 Manual ElGamal Algorithm
Prepared By:
Mohammed Ghazi Al‐Obeidallah
LAB 8 CPIT 425 Prepared by: Mohammed Ghazi Al-Obeidallah
LAB 8 Objectives:
1. Using Elgamal algorithm to Encrypt and Decrypt plain text.
2. Learn how to achieve Elgamal algorithm parameters using some calculations, predefined procedures, and user defined in procedures.
3. Trying to adjust Elgamal algorithm by using different tactics
LAB 8 main Outcomes:
1. Students will able to use Elgamal algorithm to encrypt and decrypt plaintext and they should also implement their work using a suitable programming language (Java, C#, or any .net language).
2. Students will be able calculate different Elgamal algorithm parameters such as :
a. Calculating α ( primitive root) b. Calculating YA
c. Calculating C1 and C2
LAB 8 CPIT 425 Prepared by: Mohammed Ghazi Al-Obeidallah
Example 1
Elgamal algorithm Pseudo code:
- Select Q where Q is a prime number
- Select α where α is a primitive root of Q and α < Q.
- Select Random Xa such that Xa < Q -1 - Calculate Ya , such that Ya = αXa mod Q - Public key = { Q, α, Ya}
- Private key = { Xa}
- Plain Text M < Q
- Select random k0 such that k0 < Q
- Calculate K1 such that K1 = Ya k mod Q - Calculate C1 = αk0 mod Q
- Calculate C2 = K1 * M mod Q - Cipher = (C1, C2)
- Decryption : Cipher = C1,C2
- Calculate K1 such that K1 = C1 Xa mod Q - PlainText M = (C2K1-1) mod Q
Quiz:
Use Elgamal algorithm to encrypt and decrypt the following plain text :
LAB Elgamal
Students should build their own programs to implement and test the above pseudo code.
LAB 8 CPIT 425 Prepared by: Mohammed Ghazi Al-Obeidallah
Example:
- Select Q = 19 - Select α =10.
- Select Random Xa = 5
- Calculate Ya , such that Ya = 105 mod 19 = 3 - Public key = { 19, 10, 4}
- Private key = { 5}
- Plain Text M = 17 < Q - Select random k0 = 6
- Calculate K1 such that K1 = 36 mod 19 - Calculate C1 = 106 mod 19 = 11
- Calculate C2 = 7 * 17 mod 19 = 7 - Cipher = (11, 7)
- Decryption : Cipher = C1,C2
- Calculate K1 such that K1 = C1 Xa mod Q - PlainText M = (C2K1-1) mod Q