280 likes | 488 Views
El_Gamal Cryptography. Introduction. El_Gamal is a public-key cryptosystem technique was designed by Dr. Taher Elgamal . El_Gamal depends on the one way function, means that the encryption and decryption are done in separate functions. Introduction.
E N D
El_Gamal Cryptography Data Security
Introduction • El_Gamal is a public-key cryptosystem technique was designed by Dr. Taher Elgamal . • El_Gamal depends on the one way function, means that the encryption and decryption are done in separate functions. Data Security
Introduction • The encryption process requires two modular exponentiations (extra time). • A disadvantage of El_Gamal encryption is that there is message expansion by a factor of 2. That is, the ciphertext is twice as long as the corresponding plaintext. Data Security
Key generation • Receiver A must do the following: 1- Generate a large random prime number (p) 2- Choose a generator number (a) {show in slide 7 } 3- Choose an integer (x) less than (p-2) ,as secret number. Data Security
Key generation 4- Compute (d) where d= ax mod p 5-Determine the public key (p, a, d) and the private key (x) Data Security
Key generation • Example : let p = 11 and a = 2 and x = 5 calculate d = 25 mod 11 = 10 public key = (11 ,2 ,10) private key = (5) Data Security
Generator number • How to test (a) generator or not : 1- (a) must be between 1 and p-1 2- Find Ø = p-1 3- Find the all factors of Ø {f1,f2,….,fn} – { 1 } Data Security
Generator number 4- Find {q1,q2,…..,qn} where qi = fi for the redundant factors qi = fifreq 5- (a) generator number if and only if wi= a Ø/qi mode p <> 1 , for all qi Data Security
Generator number • Example 1 : let p= 11 , a=2 ,test a is generator number or not ? sol: Ø= p-1 = 10 , factors of 10 = {2 , 5} q1 = 2 ,q2 = 5 w1 = 210/2mod 11 = 10 <> 1 w2 = 210/5mod 11 = 4 <> 1 i.e a generator number . Data Security
Generator number • Example 2 : let p= 11 , a=3 ,test a is generator number or not ? sol: Ø= p-1 = 10 , factors of 10 = {2 , 5} q1 = 2 ,q2 = 5 w1 = 310/2mod 11 = 1== 1 w2 = 310/5mod 11 = 9 <> 1 i.e a not generator number . Data Security
Generator number • Example 3 : let p= 41 , a=2 ,test a is generator number or not ? sol: Ø= p-1 = 40 , factors of 40 = {2 , 2 , 2, 5} q1 = 21 = 2 ,q2 = 22 = 4,q3 = 23 = 8 q4 = 5 w1 = 240/2 mod 41 = 0.98 <> 1 w2 = 240/4 mod 41 = 40 <> 1 Data Security
Generator number w2 = 240/8 mod 41 = 32 <> 1 w2 = 240/5 mod 41 = 10 <> 1 i.e a generator number Data Security
Encryption • Sender B must do the following : 1- Obtain the public key (p , a , d ) from the receiver A. 2- Choose an integer k such that : 1 < k < p-2 Data Security
Encryption 3- Represent the plaintext as an integer m where 0 < m < p-1 4- compute (y) as follows : y = ak mod p 5- compute (z) as follows : z = (dk * m ) mod p Data Security
Encryption 6- Find the ciphertext (C) as follows : C= ( y , z ) 7- The sender B send C to The receiver A . Data Security
Decryption • Receiver A must do the following : 1- Obtain the ciphertext (C) from B . 2- compute (r) as follows : r = yp-1-x mod p 3- Recover the plaintext as follows: m = ( r * z ) mod p Data Security
Example Let p = 11 and a generator number = 2 and select integer number x = 5 calculate d = 25 mod 11 = 10 Then public key = ( 11 , 2 , 10) private key = (5) Data Security
Example Plaintext = Age Represent the plaintext as integer value as follows: The new plaintext = ( 1 7 5 ) Data Security
Example Encryption (sender): y = ak mod p , z = (dk * m ) mod p Choose an random integer value k = 6 yA = 26 mod 11 = 9 zA = (106*1) mod 11 = 1 Data Security
Example Choose an random integer value k = 4 yg = 24 mod 11 = 5 zg = (104*7) mod 11 = 7 Choose an random integer value k = 7 ye = 27 mod 11 = 7 ze = (107*5) mod 11 = 6 Ciphertext = (9,1) (5,7) (7,6) The sender B send the ciphertext to the receiver A. Data Security
Example The receiver decrypt the ciphertext as follows : Compute (r) and (m) where r = yp-1-x mod p , m = ( r * z ) mod p r1= 911-1-5 mod 11 = 1 m1= (1*1) mod 11= 1 Data Security
Example r1= 511-1-5 mod 11 = 1 m2 = ( 1 * 7 ) mod 11 = 7 r1= 711-1-5 mod 11 = 10 m3 = ( 10 * 6 ) mod 11 = 5 Data Security
Example The receiver find the plaintext ( 1 7 5 ) Convert the plaintext to letters = Age Data Security
End • For more information about EL_Gamal cryptosystem please visit : http://en.wikipedia.org/wiki/Taher_ElGamal Data Security