Write a onepage summary of the RSA publickey encryption algo
Write a one-page summary of the RSA public-key encryption algorithm.
• Briefly explain the algorithm.
• Present the Diffie-Hellman key exchange and discuss how it may fail against the man-in-the-middle attack.
• In your opinion what needs to be done to help Diffie-Hellman key exchange to stand against the man-in-the-middle attack.
Solution
A) RSA algo
RSA algorithm was developed by Ron Rivest, Adi Shamir, and Len Adleman
it depends on two functions , 1) generation of key pair and 2) encryption-decryption algorithms.
1) Generation of key pair
we need to define two key one public key and one private key
- select two large prime p and q
- calculate n=p*q which is larger number
Number e must be greater than 1 and less than (p 1)(q 1).
There must be no common factor for e and (p 1)(q 1) except for 1. In other words two numbers e and (p – 1)(q – 1) are coprime
forming public key
The pair of numbers (n, e) form the RSA public key and is made public.
Generating private key
Private Key d is calculated from p, q, and e. For given n and e, there is unique number d.
Number d is the inverse of e modulo (p - 1)(q – 1). This means that d is the number less than (p - 1)(q - 1) such that when multiplied by e, = to 1 modulo (p - 1)(q - 1).
Mathamatically
ed=1 mod (p-1)(q-1)
example
two primes be p = 7 and q = 13. n = pq = 91.
Select e = 5, which is a valid choice since there is no number that is common factor of 5 and (p 1)(q 1) = 6 × 12 = 72, except for 1.
The pair of numbers (n, e) = (91, 5) forms the public key
Input p = 7, q = 13, and e = 5 The output will be d = 29.
Check that the d calculated is correct by computing
public key is (91, 5) and private keys is (91, 29).
B)
Diffie-Helman is a way of generating a shared secret between two people in such a way that the secret can\'t be seen by observing the communication. using the key that two parties can use for a symmetric encryption, in such a way that an eavesdropper cannot obtain the key.
Party A and Party B agree on a prime number p and a base g.
Party A chooses a secret number a, and sends Party A ( g a mod p).
Party B chooses a secret number b, and sends Party A ( g b mod p).
Party A computes (( g b mod p ) a mod p).
Party B computes (( g a mod p ) b mod p).
Both can use this number as their key. Notice that p and g need not be protected
how it fail against the men in middle attaack
The Diffie-Hellman key exchange is vulnerable to a man-in-the-middle attack. In this attack, an opponent Party C intercepts Party A\'s public value and sends her own public value to Party B. When Party B transmits his public value, Party C substitutes it with her own and sends it to Party A. Party C and Party A thus agree on one shared key and Party C and Party B agree on another shared key. After this exchange, Party C simply decrypts any messages sent out by Party A , Party B, and then reads and possibly modifies them before re-encrypting with the appropriate key and transmitting them to the other party. This vulnerability is present because Diffie-Hellman key exchange does not authenticate the participants
C) you can use digital signature for prevanting this attack

