Known to Everyone (Public Parameters):
Z (modulus): A large prime number.
X (generator): A primitive root modulo Z.
In our example, let's use:
X = 3
Z = 17
Participants:
Let's call our two participants Alice (A) and Bob (B).
Alice's Steps:
Choose a Private Key (y): Alice secretly selects a random private number.
Alice's private y = 15
Calculate Public Key: Alice computes her public key using the formula: X ^ y mod Z
Alice's Public Key = 3 ^ 15 mod 17 = 6
Bob's Steps:
Choose a Private Key (y): Bob secretly selects a random private number.
Bob's private y = 13
Calculate Public Key: Bob computes his public key using the formula: X ^ y mod Z
Bob's Public Key = 3 ^ 13 mod 17 = 12
Exchanging Public Keys:
Alice sends her Public Key (6) to Bob.
Bob sends his Public Key (12) to Alice.
(Important: These public keys can be intercepted, but an eavesdropper cannot easily determine the private keys or the shared secret from them.)
Calculating the Shared Secret Key:
Now, both Alice and Bob have their own private key, their own public key, and the other person's public key. They can independently calculate the same shared secret key.
Alice's Calculation:
Alice uses Bob's Public Key (received) and her own Private Key.
Shared Secret Key = (Bob's Public Key) ^ (Alice's private y) mod Z
Shared Secret Key = 12 ^ 15 mod 17 = 10
Bob's Calculation:
Bob uses Alice's Public Key (received) and his own Private Key.
Shared Secret Key = (Alice's Public Key) ^ (Bob's private y) mod Z
Shared Secret Key = 6 ^ 13 mod 17 = 10
Result:
Both Alice and Bob have independently arrived at the same Shared Secret Key = 10.
This shared secret key can then be used for symmetric data encryption, ensuring that only Alice and Bob can encrypt and decrypt their communications. No one else can know this shared key.

No comments:
Post a Comment