Presentation is loading. Please wait.

Presentation is loading. Please wait.

Public Key Cryptography By: Noor Dhia Al- Shakarchy.

Similar presentations


Presentation on theme: "Public Key Cryptography By: Noor Dhia Al- Shakarchy."— Presentation transcript:

1 Public Key Cryptography By: Noor Dhia Al- Shakarchy

2 Public Key Cryptography: Public-key cryptography is also known as asymmetric-key cryptography or exponential cipher which was introduced by Whitfield Diffie and Martin Hellman in 1975. Encryption and decryption is carried out using two different keys. The two keys in such a key pair are referred to as the public key and the private key. (As we will see, this solves one of the most vexing problems associated with symmetric-key cryptography — the problem of key distribution). With public key cryptography, all parties interested in secure communications can publish their public keys.

3 Public Key Cryptography: Party A, if wanting to communicate confidentially with party B, can encrypt a message using B’s publicly available key. Such a communication would only be decipherable by B as only B would have access to the corresponding private key. Party A, if wanting to send an authenticated message to party B, would encrypt the message with A’s own private key. Since this message would only be decipherable with A’s public key, that would establish the authenticity of the message — meaning that A was indeed the source of the message.

4 Public Key Cryptography: Advantages to Public Key Cryptography –Key distribution much easier: everyone can known your public key as long as your private key remains secret –Fewer keys needed Disadvantages –Slow, often up to 1000x slower than symmetric-key cryptography

5 Exponential Cipher Public key system encrypted a message block M € [ 0, n-1] by computing the exponential ( i.e. encrypted and decrypted transformation are based on modular exponentiation): C = M e mod n ………………… 1 Where e (public key) and n are the keys of encryption transformation, M is restored by the same operation using different exponential key d(secret key): M = C d mod n ………………… 2 By symmetry, encryption and decryption are commutative and matual inverses, thus substituting (2) by (1): M = (M e mod n ) d mod n = M ed mod n = M

6 Number Thory Difinition: two positive integers x and y are relatively prime if they have no common factors, i.e. their greatest common divisor is 1. we write gcd(x,y) =1. ---------------------------------------------------------------------------------------- One: (a1 op a2) mod n = [(a1 mod n) op (a2 mod n) ] mod n {op = *, +, -}. Example:- (12 + 27 + 53) mod 9 = ? Either : (12 + 27 + 53) mod 9 = 92 mod 9 = 2 Or : [ ( 12 mod 9) + (27 mod 9 ) + ( 53 mod 9)] mod 9 = [ 3 + 0 + 8] mod 9 = 11 mod 9 = 2 ----------------------------------------------------------------------------------------

7 Number Thory Two: e t mod n = [ ∏ i t =1 ( e mod n) ] mod n where 0 ≤ x ≤ n-1. Example: 3 5 mod 7 = Either :- 3 5 mod 7 = 243 mod 7 = 5 Or :- 3 5 mod 7 = [ ( 3 mod 7). ( 3 mod 7). ( 3 mod 7). ( 3 mod 7). ( 3 mod 7)] mod 7 = [ 3.3.3.3.3.] mod 7 = 5 ---------------------------------------------------------------------------------------- Three : if GCD (a,n)=1 ; then these exist an integer x, 0 < x < n, such that ax mod n =1. Example 3x mod 10 → a = 3, n = 10, GCD(3,10) =1 Then x= 7 { according to theorem 3}.

8 Number Thory Four: Euler function (Ø ) Difinition: Let n be a positive integer. The Euler function Ø (n) is the number of positive less than n that are relativily prime to n { GCD =1}. Example: Ø (15) = ? Ø (1) = GCD(15, 1) =1 Ø (2) = GCD(15, 2) =1 Ø (3) = GCD(15, 3) ≠1 and so on to Ø (15) Ø (15) = 1,2,4,7,8, 11,13, 14 = 8 ---------------------------------------------------------------------------------------------------------- Five: Ø (p) = p-1, if p is a prime number. Six : if n = p * q, and p, q are primes positive integers then : Ø (n) = Ø (p) * Ø (q) = (p-1) * (q -1). Example:- Ø (15) = ? Ø (15) =Ø (5 * 3) = Ø (5) * Ø (3) = 4 * 2 = 8.

9 Number Thory Seven: if n = P e1 1 * P e2 2 * P e3 3 * ….. * P et t where P i are primes, 1 ≤ i ≤ t then: Ø (n) = ∏ t i=1 P i ei-1 * (P i-1 ) Example:- Ø (24) = ? 24 = 2 3. 3 1 Ø (24) =2 3-1 (2-1). 3 1-1 (3-1) = 2 2 (1)* 3 0 (2) =4 * 2 = 8. ---------------------------------------------------------------------------------------- eight:( Euler’s theorem) If m is a positive integer and a is an integer with gcd(a,m)= 1, then a Ø (m) mod m =1. nine: (Fermat’s theorem) Special case of Euler’s theorem : if GCD(a, p) =1, then a p-1 mod p =1, where p is prime.

10 Number Thory Ten: V a,n GCD (a,n) =1, a Ø (n) mod n =1. Eleven: if ax mod n = 1 and CGD(a,n) = 1, the solution is : X = a Ø (n)-1 mod n Twelve: if n is prime, ax mod n =1, and GCD(a,n) =1, the solution is X = a (n-1)-1 mod n = a n-2 mod n ---------------------------------------------------------------------------------------- Examples:- 3 4 mod 5 = 1 {according to thermo 9} ---------------------------------------------------------------------------------------- N =24, Ø (n) = 8, a =7, 7 8 mod 24 =1 { according to theorem 10}. ---------------------------------------------------------------------------------------- 3x mod 10 = 1 a=3, n = 10. GCD(3,10 ) = 1 Ø (10) = Ø (5 * 2) = 4* 1 = 4 X = a Ø (10)-1 mod 10 = 3 4-1 mod 10 = 3 3 mod 10 = 27 mod 10 = 7

11 Number Thory Theorem 13: Let g = GCD(a,n), if b/g (i.e b mod g = 0) the equation ax mod n = b. will have g solution of forms: X= [ (b/g) x 0 + t (n/g) ] mod n t = 0, …, g-1. Where x 0 is the solution to : (a/g) x 0 mod (n/g) = 1, otherwise it will have no solution. Example: 6X mod 10 = 4 ← b Gcd (6,10) = 2 ← g 4 mod 2 =0 [ b mod g = 0 ] There are two solution: T = 0, 1 → (2-1) (a/g) X mod (n/g) =1 [ X = X 0 ] (6/2) X mod (10/2) =1 3X mod 5 = 1 → X = X 0 = 2 X 1 = [( 4/2) * 2] mod 10 =4 X 2 = (4 + 5) mod 10 = 9 Apply X1,X2 in ordinal equation 6 x mod 10 = 4 (6 * 4) mod 10 = 24 mod 10 = 4 (6 * 9) mod 10 = 54 mod 10 = 4

12 Exponential Cipher Theorem 14: Given e and d satisfying e.d mod Ø (n) =1 and a message M € [0,n-1] such that gcd (M,n) =1; ( M e mod n ) d mod n = M Note: When we pick d ; e can calculated from d by: e = inv (d, Ø (n)) and versa wise. Example: N=11, d= 7, M = 5, encrypt (M)? Ø (n) = Ø (11) = 11-1 = 10 e = inv (7,10) = 3 check the conditions: 1- ed mod Ø (n) =? 1 3* 7 mod 10 = 1 pass 2- M = 5 → 5 € [0,10] pass 3- gcd (5,11) = 1 pass Encrypted M : C = M e mod n = 5 3 mod 11 = 4 Decrypted M = C d mod n = 4 7 mod 11 = 5


Download ppt "Public Key Cryptography By: Noor Dhia Al- Shakarchy."

Similar presentations


Ads by Google