The steps for completing the protocol are as follows:
- The two communicating parties, Alice and Bob will decide on two numbers. One number, P is a large prime number. The second number, I is any integer that is less than P. For this case let's say that P=17 and I=4
- Both parties will then generate another number known as the private key. Alice will generate random number a and Bob will generate random number b. All numbers are integers. random number a=15 random number b=6
- Both parties will then calculate their unique public keys. Alice's public key is computed with the equation I^a modulo P. Likewise, Bob's public key is computed with I^b modulo P. Alice's public key A = 4^15 mod 17 = 13 Bob's public key B = 4^6 mod 17 = 16
- Alice and Bob will then send each other their public keys A and B.
- Since each party has acquired the other's public key each will then calculate the session key. Alice will calculate the session key using the following equation. I^ab=(I^b mod P)^a mod P. And Bob will calculate the session key using I^ba=(I^a mod P)^b mod P. I^ab and I^ba are equal and therefore the session key K is known by both parties. Alice solves for K = (16)^15 mod 17 = 16 = K Bob solves for K = (13)^6 mod 17 = 16 = K
Of course the above example uses extremely small numbers and would not be secure. However, the actual protocol calls for much larger numbers that in theory are uncrackable by today's encryption standards. Also, the method is subject to the man in the middle attack. Therefore, to make the key exchange secure a trusted third party is needed to verify digital signatures.
