discrete mathematics with applications math236
play

Discrete Mathematics with Applications MATH236 Dr. Hung P. - PowerPoint PPT Presentation

Discrete Mathematics with Applications MATH236 Dr. Hung P. Tong-Viet School of Mathematics, Statistics and Computer Science University of KwaZulu-Natal Pietermaritzburg Campus Semester 1, 2013 Tong-Viet (UKZN) MATH236 Semester 1, 2013 1 /


  1. Digital signatures with RSA Digital Signature From Bob’s perspective: 1 Bob receives a message ( M || M ′ ) pub ( Bob ) from someone claiming to be Alice. He begins by using his private key pri ( Bob ) to remove the outer layer of encryption, recovering M || M ′ , which he separates into M and M ′ . 2 Bob now encrypts M ′ with Alice’s public key, pub(Alice), i.e., he finds pub ( Alice ) = ( M ′ ) e mod n and compare it with M , the first half of M ′ the concatenated message he received. There are two possibilities: pub ( Alice ) = M . Then Bob knows that M ′ was encrypted with Alice’s M ′ private key. This proves that the message M is from Alice pub ( Alice ) � = M . Therefore, either M ′ was not encrypted with Alice’s M ′ private key, Tong-Viet (UKZN) MATH236 Semester 1, 2013 6 / 22

  2. Digital signatures with RSA Digital Signature From Bob’s perspective: 1 Bob receives a message ( M || M ′ ) pub ( Bob ) from someone claiming to be Alice. He begins by using his private key pri ( Bob ) to remove the outer layer of encryption, recovering M || M ′ , which he separates into M and M ′ . 2 Bob now encrypts M ′ with Alice’s public key, pub(Alice), i.e., he finds pub ( Alice ) = ( M ′ ) e mod n and compare it with M , the first half of M ′ the concatenated message he received. There are two possibilities: pub ( Alice ) = M . Then Bob knows that M ′ was encrypted with Alice’s M ′ private key. This proves that the message M is from Alice pub ( Alice ) � = M . Therefore, either M ′ was not encrypted with Alice’s M ′ private key, or some malicious third party altered the text M after Alice added her signature; in either case, Tong-Viet (UKZN) MATH236 Semester 1, 2013 6 / 22

  3. Digital signatures with RSA Digital Signature From Bob’s perspective: 1 Bob receives a message ( M || M ′ ) pub ( Bob ) from someone claiming to be Alice. He begins by using his private key pri ( Bob ) to remove the outer layer of encryption, recovering M || M ′ , which he separates into M and M ′ . 2 Bob now encrypts M ′ with Alice’s public key, pub(Alice), i.e., he finds pub ( Alice ) = ( M ′ ) e mod n and compare it with M , the first half of M ′ the concatenated message he received. There are two possibilities: pub ( Alice ) = M . Then Bob knows that M ′ was encrypted with Alice’s M ′ private key. This proves that the message M is from Alice pub ( Alice ) � = M . Therefore, either M ′ was not encrypted with Alice’s M ′ private key, or some malicious third party altered the text M after Alice added her signature; in either case, Bob knows that the message was not authorised by Alice. Tong-Viet (UKZN) MATH236 Semester 1, 2013 6 / 22

  4. Digital signatures with RSA Digital Signature From Bob’s perspective: 1 Bob receives a message ( M || M ′ ) pub ( Bob ) from someone claiming to be Alice. He begins by using his private key pri ( Bob ) to remove the outer layer of encryption, recovering M || M ′ , which he separates into M and M ′ . 2 Bob now encrypts M ′ with Alice’s public key, pub(Alice), i.e., he finds pub ( Alice ) = ( M ′ ) e mod n and compare it with M , the first half of M ′ the concatenated message he received. There are two possibilities: pub ( Alice ) = M . Then Bob knows that M ′ was encrypted with Alice’s M ′ private key. This proves that the message M is from Alice pub ( Alice ) � = M . Therefore, either M ′ was not encrypted with Alice’s M ′ private key, or some malicious third party altered the text M after Alice added her signature; in either case, Bob knows that the message was not authorised by Alice. Tong-Viet (UKZN) MATH236 Semester 1, 2013 6 / 22

  5. Digital signatures with RSA Examples Suppose that Alice wishes to send the signed and encrypted message ‘go’ to Bob and that pub(Alice)=(2773,17) and pri(Alice)=157 and Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 22

  6. Digital signatures with RSA Examples Suppose that Alice wishes to send the signed and encrypted message ‘go’ to Bob and that pub(Alice)=(2773,17) and pri(Alice)=157 and pub(Bob)=(3233,19) and pri(Bob)=2299 Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 22

  7. Digital signatures with RSA Examples Suppose that Alice wishes to send the signed and encrypted message ‘go’ to Bob and that pub(Alice)=(2773,17) and pri(Alice)=157 and pub(Bob)=(3233,19) and pri(Bob)=2299 Alice encodes the message as M = 0715 Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 22

  8. Digital signatures with RSA Examples Suppose that Alice wishes to send the signed and encrypted message ‘go’ to Bob and that pub(Alice)=(2773,17) and pri(Alice)=157 and pub(Bob)=(3233,19) and pri(Bob)=2299 Alice encodes the message as M = 0715 She encrypts M by the rule M ′ = M 157 mod 2773 to produce the message signature M pri ( Alice ) = 2192 Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 22

  9. Digital signatures with RSA Examples Suppose that Alice wishes to send the signed and encrypted message ‘go’ to Bob and that pub(Alice)=(2773,17) and pri(Alice)=157 and pub(Bob)=(3233,19) and pri(Bob)=2299 Alice encodes the message as M = 0715 She encrypts M by the rule M ′ = M 157 mod 2773 to produce the message signature M pri ( Alice ) = 2192 So M || M ′ = 0715 2192 Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 22

  10. Digital signatures with RSA Examples Suppose that Alice wishes to send the signed and encrypted message ‘go’ to Bob and that pub(Alice)=(2773,17) and pri(Alice)=157 and pub(Bob)=(3233,19) and pri(Bob)=2299 Alice encodes the message as M = 0715 She encrypts M by the rule M ′ = M 157 mod 2773 to produce the message signature M pri ( Alice ) = 2192 So M || M ′ = 0715 2192 Alice now encrypts each block B with Bob’s public key, using the rule C = B 19 mod 3233 to obtain Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 22

  11. Digital signatures with RSA Examples Suppose that Alice wishes to send the signed and encrypted message ‘go’ to Bob and that pub(Alice)=(2773,17) and pri(Alice)=157 and pub(Bob)=(3233,19) and pri(Bob)=2299 Alice encodes the message as M = 0715 She encrypts M by the rule M ′ = M 157 mod 2773 to produce the message signature M pri ( Alice ) = 2192 So M || M ′ = 0715 2192 Alice now encrypts each block B with Bob’s public key, using the rule C = B 19 mod 3233 to obtain ( M || M pri ( Alice ) ) pub ( Bob ) = 1718 2330 and she sends this to Bob Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 22

  12. Digital signatures with RSA Examples Suppose that Alice wishes to send the signed and encrypted message ‘go’ to Bob and that pub(Alice)=(2773,17) and pri(Alice)=157 and pub(Bob)=(3233,19) and pri(Bob)=2299 Alice encodes the message as M = 0715 She encrypts M by the rule M ′ = M 157 mod 2773 to produce the message signature M pri ( Alice ) = 2192 So M || M ′ = 0715 2192 Alice now encrypts each block B with Bob’s public key, using the rule C = B 19 mod 3233 to obtain ( M || M pri ( Alice ) ) pub ( Bob ) = 1718 2330 and she sends this to Bob Tong-Viet (UKZN) MATH236 Semester 1, 2013 7 / 22

  13. Digital signatures with RSA Examples Bob receives the ciphertext Y = 1718 2330 First, he uses his private key d = 2299 with the rule C = B 2299 to discover the underline message is X = 0715 2192 Tong-Viet (UKZN) MATH236 Semester 1, 2013 8 / 22

  14. Digital signatures with RSA Examples Bob receives the ciphertext Y = 1718 2330 First, he uses his private key d = 2299 with the rule C = B 2299 to discover the underline message is X = 0715 2192 He decodes the message to go || 2192 Tong-Viet (UKZN) MATH236 Semester 1, 2013 8 / 22

  15. Digital signatures with RSA Examples Bob receives the ciphertext Y = 1718 2330 First, he uses his private key d = 2299 with the rule C = B 2299 to discover the underline message is X = 0715 2192 He decodes the message to go || 2192 Bob now verifies the signature, he decrypts the second half of the message with Alice’s public key pub(Alice)=(2773,17) and the rule C = B 17 mod 2773 Tong-Viet (UKZN) MATH236 Semester 1, 2013 8 / 22

  16. Digital signatures with RSA Examples Bob receives the ciphertext Y = 1718 2330 First, he uses his private key d = 2299 with the rule C = B 2299 to discover the underline message is X = 0715 2192 He decodes the message to go || 2192 Bob now verifies the signature, he decrypts the second half of the message with Alice’s public key pub(Alice)=(2773,17) and the rule C = B 17 mod 2773 The signature becomes 0715 which is translated to ‘go’ Tong-Viet (UKZN) MATH236 Semester 1, 2013 8 / 22

  17. Digital signatures with RSA Examples Bob receives the ciphertext Y = 1718 2330 First, he uses his private key d = 2299 with the rule C = B 2299 to discover the underline message is X = 0715 2192 He decodes the message to go || 2192 Bob now verifies the signature, he decrypts the second half of the message with Alice’s public key pub(Alice)=(2773,17) and the rule C = B 17 mod 2773 The signature becomes 0715 which is translated to ‘go’ So Bob knows that the message was authorised by Alice Tong-Viet (UKZN) MATH236 Semester 1, 2013 8 / 22

  18. Digital signatures with RSA Examples Bob receives the ciphertext Y = 1718 2330 First, he uses his private key d = 2299 with the rule C = B 2299 to discover the underline message is X = 0715 2192 He decodes the message to go || 2192 Bob now verifies the signature, he decrypts the second half of the message with Alice’s public key pub(Alice)=(2773,17) and the rule C = B 17 mod 2773 The signature becomes 0715 which is translated to ‘go’ So Bob knows that the message was authorised by Alice Tong-Viet (UKZN) MATH236 Semester 1, 2013 8 / 22

  19. The mathematics of RSA The mathematics of RSA Lemma Let p and q be distinct primes and let a and b be integers. If a ≡ b (mod p) and a ≡ b (mod q), then a ≡ b (mod pq). Proof. By the hypothesis, we obtain that p | a − b and q | a − b We have that a − b = qm for some integer m Tong-Viet (UKZN) MATH236 Semester 1, 2013 9 / 22

  20. The mathematics of RSA The mathematics of RSA Lemma Let p and q be distinct primes and let a and b be integers. If a ≡ b (mod p) and a ≡ b (mod q), then a ≡ b (mod pq). Proof. By the hypothesis, we obtain that p | a − b and q | a − b We have that a − b = qm for some integer m It follows that p | a − b = qm Tong-Viet (UKZN) MATH236 Semester 1, 2013 9 / 22

  21. The mathematics of RSA The mathematics of RSA Lemma Let p and q be distinct primes and let a and b be integers. If a ≡ b (mod p) and a ≡ b (mod q), then a ≡ b (mod pq). Proof. By the hypothesis, we obtain that p | a − b and q | a − b We have that a − b = qm for some integer m It follows that p | a − b = qm Since p � = q are primes, we have gcd( p , q ) = 1 so that p | m Tong-Viet (UKZN) MATH236 Semester 1, 2013 9 / 22

  22. The mathematics of RSA The mathematics of RSA Lemma Let p and q be distinct primes and let a and b be integers. If a ≡ b (mod p) and a ≡ b (mod q), then a ≡ b (mod pq). Proof. By the hypothesis, we obtain that p | a − b and q | a − b We have that a − b = qm for some integer m It follows that p | a − b = qm Since p � = q are primes, we have gcd( p , q ) = 1 so that p | m Hence, pq | qm = a − b or equivalently a ≡ b (mod pq ) as wanted. Tong-Viet (UKZN) MATH236 Semester 1, 2013 9 / 22

  23. The mathematics of RSA The mathematics of RSA Lemma Let p and q be distinct primes and let a and b be integers. If a ≡ b (mod p) and a ≡ b (mod q), then a ≡ b (mod pq). Proof. By the hypothesis, we obtain that p | a − b and q | a − b We have that a − b = qm for some integer m It follows that p | a − b = qm Since p � = q are primes, we have gcd( p , q ) = 1 so that p | m Hence, pq | qm = a − b or equivalently a ≡ b (mod pq ) as wanted. Tong-Viet (UKZN) MATH236 Semester 1, 2013 9 / 22

  24. The mathematics of RSA The RSA Theorem Theorem Let ( n , e ) be a public key for the RSA cryptosystem and ( n , d ) the corresponding private key, and let E ( M ) = M e mod n and D ( C ) = C d mod n be the encryption and decryption rules, respectively. Tong-Viet (UKZN) MATH236 Semester 1, 2013 10 / 22

  25. The mathematics of RSA The RSA Theorem Theorem Let ( n , e ) be a public key for the RSA cryptosystem and ( n , d ) the corresponding private key, and let E ( M ) = M e mod n and D ( C ) = C d mod n be the encryption and decryption rules, respectively. Then D ( E ( M )) = M (mod n) . Tong-Viet (UKZN) MATH236 Semester 1, 2013 10 / 22

  26. The mathematics of RSA The RSA Theorem Theorem Let ( n , e ) be a public key for the RSA cryptosystem and ( n , d ) the corresponding private key, and let E ( M ) = M e mod n and D ( C ) = C d mod n be the encryption and decryption rules, respectively. Then D ( E ( M )) = M (mod n) . Tong-Viet (UKZN) MATH236 Semester 1, 2013 10 / 22

  27. The mathematics of RSA Proof of the RSA Theorem Proof. Since ed ≡ 1 (mod φ ( n )), there exists some integer k such that ed = 1 + k φ ( n ) Hence ( M e ) d (mod n ) D ( E ( M )) ≡ M ed (mod n ) ≡ M k φ ( n )+1 (mod n ) ≡ Tong-Viet (UKZN) MATH236 Semester 1, 2013 11 / 22

  28. The mathematics of RSA Proof of the RSA Theorem Proof. Since ed ≡ 1 (mod φ ( n )), there exists some integer k such that ed = 1 + k φ ( n ) Hence ( M e ) d (mod n ) D ( E ( M )) ≡ M ed (mod n ) ≡ M k φ ( n )+1 (mod n ) ≡ Let p and q be primes such that n = pq Tong-Viet (UKZN) MATH236 Semester 1, 2013 11 / 22

  29. The mathematics of RSA Proof of the RSA Theorem Proof. Since ed ≡ 1 (mod φ ( n )), there exists some integer k such that ed = 1 + k φ ( n ) Hence ( M e ) d (mod n ) D ( E ( M )) ≡ M ed (mod n ) ≡ M k φ ( n )+1 (mod n ) ≡ Let p and q be primes such that n = pq If p does not divide M , then by Fermat’s Little Theorem, we have M p − 1 ≡ 1 (mod p ) Tong-Viet (UKZN) MATH236 Semester 1, 2013 11 / 22

  30. The mathematics of RSA Proof of the RSA Theorem Proof. Since ed ≡ 1 (mod φ ( n )), there exists some integer k such that ed = 1 + k φ ( n ) Hence ( M e ) d (mod n ) D ( E ( M )) ≡ M ed (mod n ) ≡ M k φ ( n )+1 (mod n ) ≡ Let p and q be primes such that n = pq If p does not divide M , then by Fermat’s Little Theorem, we have M p − 1 ≡ 1 (mod p ) Tong-Viet (UKZN) MATH236 Semester 1, 2013 11 / 22

  31. The mathematics of RSA Proof of the RSA Theorem Proof. Raising both sides to the power k ( q − 1) , we have M k ( p − 1)( q − 1) ≡ 1 (mod p) So M k φ ( n ) · M ≡ 1 · M (mod p ) Tong-Viet (UKZN) MATH236 Semester 1, 2013 12 / 22

  32. The mathematics of RSA Proof of the RSA Theorem Proof. Raising both sides to the power k ( q − 1) , we have M k ( p − 1)( q − 1) ≡ 1 (mod p) So M k φ ( n ) · M ≡ 1 · M (mod p ) Finally, we obtain M k φ ( n )+1 ≡ M (mod p ) Tong-Viet (UKZN) MATH236 Semester 1, 2013 12 / 22

  33. The mathematics of RSA Proof of the RSA Theorem Proof. Raising both sides to the power k ( q − 1) , we have M k ( p − 1)( q − 1) ≡ 1 (mod p) So M k φ ( n ) · M ≡ 1 · M (mod p ) Finally, we obtain M k φ ( n )+1 ≡ M (mod p ) The previous equation is trivially true if p | M . So it is true for all M . Tong-Viet (UKZN) MATH236 Semester 1, 2013 12 / 22

  34. The mathematics of RSA Proof of the RSA Theorem Proof. Raising both sides to the power k ( q − 1) , we have M k ( p − 1)( q − 1) ≡ 1 (mod p) So M k φ ( n ) · M ≡ 1 · M (mod p ) Finally, we obtain M k φ ( n )+1 ≡ M (mod p ) The previous equation is trivially true if p | M . So it is true for all M . Similarly, we obtain that M k φ ( n )+1 ≡ 1 (mod q ) Tong-Viet (UKZN) MATH236 Semester 1, 2013 12 / 22

  35. The mathematics of RSA Proof of the RSA Theorem Proof. Raising both sides to the power k ( q − 1) , we have M k ( p − 1)( q − 1) ≡ 1 (mod p) So M k φ ( n ) · M ≡ 1 · M (mod p ) Finally, we obtain M k φ ( n )+1 ≡ M (mod p ) The previous equation is trivially true if p | M . So it is true for all M . Similarly, we obtain that M k φ ( n )+1 ≡ 1 (mod q ) By the previous lemma, we deduce that D ( E ( M )) ≡ M k φ ( n )+1 ≡ M (mod n ) as wanted. Tong-Viet (UKZN) MATH236 Semester 1, 2013 12 / 22

  36. The mathematics of RSA Proof of the RSA Theorem Proof. Raising both sides to the power k ( q − 1) , we have M k ( p − 1)( q − 1) ≡ 1 (mod p) So M k φ ( n ) · M ≡ 1 · M (mod p ) Finally, we obtain M k φ ( n )+1 ≡ M (mod p ) The previous equation is trivially true if p | M . So it is true for all M . Similarly, we obtain that M k φ ( n )+1 ≡ 1 (mod q ) By the previous lemma, we deduce that D ( E ( M )) ≡ M k φ ( n )+1 ≡ M (mod n ) as wanted. Tong-Viet (UKZN) MATH236 Semester 1, 2013 12 / 22

  37. The El Gamal public-key cryptosystem El Gamal: Key generation This system was first published by Taher El Gamal in 1985 Suppose that Alice wants to use the El Gamal system Tong-Viet (UKZN) MATH236 Semester 1, 2013 13 / 22

  38. The El Gamal public-key cryptosystem El Gamal: Key generation This system was first published by Taher El Gamal in 1985 Suppose that Alice wants to use the El Gamal system She must first generate a key-pair: pri(Alice) and pub(Alice) Tong-Viet (UKZN) MATH236 Semester 1, 2013 13 / 22

  39. The El Gamal public-key cryptosystem El Gamal: Key generation This system was first published by Taher El Gamal in 1985 Suppose that Alice wants to use the El Gamal system She must first generate a key-pair: pri(Alice) and pub(Alice) This is accomplished as follows: Tong-Viet (UKZN) MATH236 Semester 1, 2013 13 / 22

  40. The El Gamal public-key cryptosystem El Gamal: Key generation This system was first published by Taher El Gamal in 1985 Suppose that Alice wants to use the El Gamal system She must first generate a key-pair: pri(Alice) and pub(Alice) This is accomplished as follows: Alice chooses a large random prime p and a generator α of Z ∗ 1 p Tong-Viet (UKZN) MATH236 Semester 1, 2013 13 / 22

  41. The El Gamal public-key cryptosystem El Gamal: Key generation This system was first published by Taher El Gamal in 1985 Suppose that Alice wants to use the El Gamal system She must first generate a key-pair: pri(Alice) and pub(Alice) This is accomplished as follows: Alice chooses a large random prime p and a generator α of Z ∗ 1 p She next choses a random integer a ∈ { 2 , 3 , · · · , p − 2 } and computes 2 α a (mod p) Tong-Viet (UKZN) MATH236 Semester 1, 2013 13 / 22

  42. The El Gamal public-key cryptosystem El Gamal: Key generation This system was first published by Taher El Gamal in 1985 Suppose that Alice wants to use the El Gamal system She must first generate a key-pair: pri(Alice) and pub(Alice) This is accomplished as follows: Alice chooses a large random prime p and a generator α of Z ∗ 1 p She next choses a random integer a ∈ { 2 , 3 , · · · , p − 2 } and computes 2 α a (mod p) She sets pub ( Alice ) = ( p , α, α a ) and pri ( Alice ) = a 3 Tong-Viet (UKZN) MATH236 Semester 1, 2013 13 / 22

  43. The El Gamal public-key cryptosystem El Gamal: Key generation This system was first published by Taher El Gamal in 1985 Suppose that Alice wants to use the El Gamal system She must first generate a key-pair: pri(Alice) and pub(Alice) This is accomplished as follows: Alice chooses a large random prime p and a generator α of Z ∗ 1 p She next choses a random integer a ∈ { 2 , 3 , · · · , p − 2 } and computes 2 α a (mod p) She sets pub ( Alice ) = ( p , α, α a ) and pri ( Alice ) = a 3 Tong-Viet (UKZN) MATH236 Semester 1, 2013 13 / 22

  44. The El Gamal public-key cryptosystem El Gamal: Key generation-Examples Example Suppose that Alice chooses the prime p = 149 She now find a generator α of Z ∗ 149 (Using Theorem 40) Tong-Viet (UKZN) MATH236 Semester 1, 2013 14 / 22

  45. The El Gamal public-key cryptosystem El Gamal: Key generation-Examples Example Suppose that Alice chooses the prime p = 149 She now find a generator α of Z ∗ 149 (Using Theorem 40) She decides to try α = 5 Tong-Viet (UKZN) MATH236 Semester 1, 2013 14 / 22

  46. The El Gamal public-key cryptosystem El Gamal: Key generation-Examples Example Suppose that Alice chooses the prime p = 149 She now find a generator α of Z ∗ 149 (Using Theorem 40) She decides to try α = 5 Tong-Viet (UKZN) MATH236 Semester 1, 2013 14 / 22

  47. The El Gamal public-key cryptosystem El Gamal: Key generation-Examples Example Since 148 = 2 2 · 37 , she must compute 5 148 / 2 = 5 74 mod 149 and 5 148 / 37 = 5 4 mod 149 She finds 5 74 ≡ 1 mod 149 so 5 is not a generator Tong-Viet (UKZN) MATH236 Semester 1, 2013 15 / 22

  48. The El Gamal public-key cryptosystem El Gamal: Key generation-Examples Example Since 148 = 2 2 · 37 , she must compute 5 148 / 2 = 5 74 mod 149 and 5 148 / 37 = 5 4 mod 149 She finds 5 74 ≡ 1 mod 149 so 5 is not a generator She next tries α = 12 and finds that 12 74 ≡ 148 mod 149 and 12 4 ≡ 25 mod 149 so α = 12 is a generator for Z ∗ 149 Tong-Viet (UKZN) MATH236 Semester 1, 2013 15 / 22

  49. The El Gamal public-key cryptosystem El Gamal: Key generation-Examples Example Since 148 = 2 2 · 37 , she must compute 5 148 / 2 = 5 74 mod 149 and 5 148 / 37 = 5 4 mod 149 She finds 5 74 ≡ 1 mod 149 so 5 is not a generator She next tries α = 12 and finds that 12 74 ≡ 148 mod 149 and 12 4 ≡ 25 mod 149 so α = 12 is a generator for Z ∗ 149 She pick a = 37 and calculate α a = 12 37 ≡ 105 mod 149 Tong-Viet (UKZN) MATH236 Semester 1, 2013 15 / 22

  50. The El Gamal public-key cryptosystem El Gamal: Key generation-Examples Example Since 148 = 2 2 · 37 , she must compute 5 148 / 2 = 5 74 mod 149 and 5 148 / 37 = 5 4 mod 149 She finds 5 74 ≡ 1 mod 149 so 5 is not a generator She next tries α = 12 and finds that 12 74 ≡ 148 mod 149 and 12 4 ≡ 25 mod 149 so α = 12 is a generator for Z ∗ 149 She pick a = 37 and calculate α a = 12 37 ≡ 105 mod 149 Thus pub(Alice)=(149 , 12 , 105) and pri(Alice)=37 Tong-Viet (UKZN) MATH236 Semester 1, 2013 15 / 22

  51. The El Gamal public-key cryptosystem El Gamal: Key generation-Examples Example Since 148 = 2 2 · 37 , she must compute 5 148 / 2 = 5 74 mod 149 and 5 148 / 37 = 5 4 mod 149 She finds 5 74 ≡ 1 mod 149 so 5 is not a generator She next tries α = 12 and finds that 12 74 ≡ 148 mod 149 and 12 4 ≡ 25 mod 149 so α = 12 is a generator for Z ∗ 149 She pick a = 37 and calculate α a = 12 37 ≡ 105 mod 149 Thus pub(Alice)=(149 , 12 , 105) and pri(Alice)=37 Tong-Viet (UKZN) MATH236 Semester 1, 2013 15 / 22

  52. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Suppose that Bob wants to send Alice a message using the El Gamal cryptosystem Bob first looks up Alice’s public key pub(Alice)= ( p , α, α a ) Tong-Viet (UKZN) MATH236 Semester 1, 2013 16 / 22

  53. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Suppose that Bob wants to send Alice a message using the El Gamal cryptosystem Bob first looks up Alice’s public key pub(Alice)= ( p , α, α a ) He then represents the message as an integer M in the range { 0 , 1 , · · · , p − 1 } Tong-Viet (UKZN) MATH236 Semester 1, 2013 16 / 22

  54. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Suppose that Bob wants to send Alice a message using the El Gamal cryptosystem Bob first looks up Alice’s public key pub(Alice)= ( p , α, α a ) He then represents the message as an integer M in the range { 0 , 1 , · · · , p − 1 } Bob selects a random integer k ∈ { 1 , 2 , · · · , p − 2 } Tong-Viet (UKZN) MATH236 Semester 1, 2013 16 / 22

  55. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Suppose that Bob wants to send Alice a message using the El Gamal cryptosystem Bob first looks up Alice’s public key pub(Alice)= ( p , α, α a ) He then represents the message as an integer M in the range { 0 , 1 , · · · , p − 1 } Bob selects a random integer k ∈ { 1 , 2 , · · · , p − 2 } He then computes γ = α k mod p and δ = M ( α a ) k mod p Tong-Viet (UKZN) MATH236 Semester 1, 2013 16 / 22

  56. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Suppose that Bob wants to send Alice a message using the El Gamal cryptosystem Bob first looks up Alice’s public key pub(Alice)= ( p , α, α a ) He then represents the message as an integer M in the range { 0 , 1 , · · · , p − 1 } Bob selects a random integer k ∈ { 1 , 2 , · · · , p − 2 } He then computes γ = α k mod p and δ = M ( α a ) k mod p Finally, Bob sends ( γ, δ ) to Alice Tong-Viet (UKZN) MATH236 Semester 1, 2013 16 / 22

  57. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Suppose that Bob wants to send Alice a message using the El Gamal cryptosystem Bob first looks up Alice’s public key pub(Alice)= ( p , α, α a ) He then represents the message as an integer M in the range { 0 , 1 , · · · , p − 1 } Bob selects a random integer k ∈ { 1 , 2 , · · · , p − 2 } He then computes γ = α k mod p and δ = M ( α a ) k mod p Finally, Bob sends ( γ, δ ) to Alice Tong-Viet (UKZN) MATH236 Semester 1, 2013 16 / 22

  58. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption To decrypt the message that Bob sends her, Alice follows a two-step procedure: 1 She uses her private key pri(Alice)=a to compute γ p − 1 − a mod p Tong-Viet (UKZN) MATH236 Semester 1, 2013 17 / 22

  59. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption To decrypt the message that Bob sends her, Alice follows a two-step procedure: 1 She uses her private key pri(Alice)=a to compute γ p − 1 − a mod p 2 Now she can recover the message M by finding δγ p − 1 − a = M · α ak α − ak ≡ M mod p . Tong-Viet (UKZN) MATH236 Semester 1, 2013 17 / 22

  60. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption To decrypt the message that Bob sends her, Alice follows a two-step procedure: 1 She uses her private key pri(Alice)=a to compute γ p − 1 − a mod p 2 Now she can recover the message M by finding δγ p − 1 − a = M · α ak α − ak ≡ M mod p . Tong-Viet (UKZN) MATH236 Semester 1, 2013 17 / 22

  61. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Key generation) Suppose that Alice chooses p = 2579 She writes 2578 = 2 · 1289 Tong-Viet (UKZN) MATH236 Semester 1, 2013 18 / 22

  62. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Key generation) Suppose that Alice chooses p = 2579 She writes 2578 = 2 · 1289 She tries to find a generator for Z ∗ 2579 Tong-Viet (UKZN) MATH236 Semester 1, 2013 18 / 22

  63. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Key generation) Suppose that Alice chooses p = 2579 She writes 2578 = 2 · 1289 She tries to find a generator for Z ∗ 2579 She tries α = 2; She computes α 2 = 4 mod 2579 and α 1289 = 2578 mod 2579 Tong-Viet (UKZN) MATH236 Semester 1, 2013 18 / 22

  64. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Key generation) Suppose that Alice chooses p = 2579 She writes 2578 = 2 · 1289 She tries to find a generator for Z ∗ 2579 She tries α = 2; She computes α 2 = 4 mod 2579 and α 1289 = 2578 mod 2579 She picks a = 956 and finds 2 956 ≡ 1272 mod 2579 Tong-Viet (UKZN) MATH236 Semester 1, 2013 18 / 22

  65. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Key generation) Suppose that Alice chooses p = 2579 She writes 2578 = 2 · 1289 She tries to find a generator for Z ∗ 2579 She tries α = 2; She computes α 2 = 4 mod 2579 and α 1289 = 2578 mod 2579 She picks a = 956 and finds 2 956 ≡ 1272 mod 2579 She publishes the information pub(Alice)=(2579 , 2 , 1272) Tong-Viet (UKZN) MATH236 Semester 1, 2013 18 / 22

  66. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Key generation) Suppose that Alice chooses p = 2579 She writes 2578 = 2 · 1289 She tries to find a generator for Z ∗ 2579 She tries α = 2; She computes α 2 = 4 mod 2579 and α 1289 = 2578 mod 2579 She picks a = 956 and finds 2 956 ≡ 1272 mod 2579 She publishes the information pub(Alice)=(2579 , 2 , 1272) She keeps pri(Alice)=956 Tong-Viet (UKZN) MATH236 Semester 1, 2013 18 / 22

  67. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Key generation) Suppose that Alice chooses p = 2579 She writes 2578 = 2 · 1289 She tries to find a generator for Z ∗ 2579 She tries α = 2; She computes α 2 = 4 mod 2579 and α 1289 = 2578 mod 2579 She picks a = 956 and finds 2 956 ≡ 1272 mod 2579 She publishes the information pub(Alice)=(2579 , 2 , 1272) She keeps pri(Alice)=956 Tong-Viet (UKZN) MATH236 Semester 1, 2013 18 / 22

  68. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) Bob decides to send the message ‘nuts’ to Alice He encodes ‘nuts’ as 14212019 Tong-Viet (UKZN) MATH236 Semester 1, 2013 19 / 22

  69. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) Bob decides to send the message ‘nuts’ to Alice He encodes ‘nuts’ as 14212019 He looks up Alice’s public key and determines that p = 2579 so he decides to split the message up into two blocks, each of length 4 : 1421 2019 Tong-Viet (UKZN) MATH236 Semester 1, 2013 19 / 22

  70. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) Bob decides to send the message ‘nuts’ to Alice He encodes ‘nuts’ as 14212019 He looks up Alice’s public key and determines that p = 2579 so he decides to split the message up into two blocks, each of length 4 : 1421 2019 For additional security, he will seclect a different value of k for each block Tong-Viet (UKZN) MATH236 Semester 1, 2013 19 / 22

  71. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) Bob decides to send the message ‘nuts’ to Alice He encodes ‘nuts’ as 14212019 He looks up Alice’s public key and determines that p = 2579 so he decides to split the message up into two blocks, each of length 4 : 1421 2019 For additional security, he will seclect a different value of k for each block For the first block, M 1 = 1421 , he picks k 1 = 318 , while for the second block, M 2 = 2019 , he will use k 2 = 1905 Tong-Viet (UKZN) MATH236 Semester 1, 2013 19 / 22

  72. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) Bob decides to send the message ‘nuts’ to Alice He encodes ‘nuts’ as 14212019 He looks up Alice’s public key and determines that p = 2579 so he decides to split the message up into two blocks, each of length 4 : 1421 2019 For additional security, he will seclect a different value of k for each block For the first block, M 1 = 1421 , he picks k 1 = 318 , while for the second block, M 2 = 2019 , he will use k 2 = 1905 Tong-Viet (UKZN) MATH236 Semester 1, 2013 19 / 22

  73. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) For the first block: γ 1 = α k 1 mod p = 2 318 δ 1 = M 1 ( α a ) k 1 = 1421 · 1272 318 mod 2579 = 590 Tong-Viet (UKZN) MATH236 Semester 1, 2013 20 / 22

  74. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) For the first block: γ 1 = α k 1 mod p = 2 318 δ 1 = M 1 ( α a ) k 1 = 1421 · 1272 318 mod 2579 = 590 For the second block: γ 2 = α k 2 mod p = 2 1905 mod 2579 = 1035 Tong-Viet (UKZN) MATH236 Semester 1, 2013 20 / 22

  75. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) For the first block: γ 1 = α k 1 mod p = 2 318 δ 1 = M 1 ( α a ) k 1 = 1421 · 1272 318 mod 2579 = 590 For the second block: γ 2 = α k 2 mod p = 2 1905 mod 2579 = 1035 δ 2 = M 2 ( α a ) k 2 = 2019 · 1272 1905 mod 2579 = 1684 Tong-Viet (UKZN) MATH236 Semester 1, 2013 20 / 22

  76. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) For the first block: γ 1 = α k 1 mod p = 2 318 δ 1 = M 1 ( α a ) k 1 = 1421 · 1272 318 mod 2579 = 590 For the second block: γ 2 = α k 2 mod p = 2 1905 mod 2579 = 1035 δ 2 = M 2 ( α a ) k 2 = 2019 · 1272 1905 mod 2579 = 1684 Bob sends the message (792 , 590) , (1035 , 1684) to Alice Tong-Viet (UKZN) MATH236 Semester 1, 2013 20 / 22

  77. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) For the first block: γ 1 = α k 1 mod p = 2 318 δ 1 = M 1 ( α a ) k 1 = 1421 · 1272 318 mod 2579 = 590 For the second block: γ 2 = α k 2 mod p = 2 1905 mod 2579 = 1035 δ 2 = M 2 ( α a ) k 2 = 2019 · 1272 1905 mod 2579 = 1684 Bob sends the message (792 , 590) , (1035 , 1684) to Alice He could concatenate everything and sends 0792059010351684 to Alice Tong-Viet (UKZN) MATH236 Semester 1, 2013 20 / 22

  78. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Encryption) For the first block: γ 1 = α k 1 mod p = 2 318 δ 1 = M 1 ( α a ) k 1 = 1421 · 1272 318 mod 2579 = 590 For the second block: γ 2 = α k 2 mod p = 2 1905 mod 2579 = 1035 δ 2 = M 2 ( α a ) k 2 = 2019 · 1272 1905 mod 2579 = 1684 Bob sends the message (792 , 590) , (1035 , 1684) to Alice He could concatenate everything and sends 0792059010351684 to Alice Tong-Viet (UKZN) MATH236 Semester 1, 2013 20 / 22

  79. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Decryption) Alice receives the message 0792059010351684 from Bob, and recovers γ 1 = 792 , δ 1 = 590 and γ 2 = 1035 , δ 2 = 1684 Tong-Viet (UKZN) MATH236 Semester 1, 2013 21 / 22

  80. The El Gamal public-key cryptosystem El Gamal: Encryption and Decryption Example (Decryption) Alice receives the message 0792059010351684 from Bob, and recovers γ 1 = 792 , δ 1 = 590 and γ 2 = 1035 , δ 2 = 1684 Using her private key pri(Alice)= a = 956 , she decrypts the first block Tong-Viet (UKZN) MATH236 Semester 1, 2013 21 / 22

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend