All Packages Class Hierarchy This Package Previous Next Index
Class AcmeNet.Assn3.DiffieHellman
AcmeNet.Assn3.DiffieHellman
- class DiffieHellman
Implements the Diffie-Hellman key exchange algorithm. This class does not perform any
communication, but it does all of the necessary mathematical operations. Diffie-Hellman is
a clever mathematical trick that lets two parties who have never spoken establish a shared
secret. Even if an adversary overhears their entire conversation, the adversary still cannot
figure out the shared secret. Diffie-Hellman is a well-known and frequently used algorithm.
It was patented, but the patent expired on September 6, 1997.
To do a Diffie-Hellman exchange, follow these steps:
- create a DiffieHellman object
- read its
gx
variable, convert the value to a character string, and send
it to the other side
- receive the string sent by the other side, and convert it to a java.math.BitInteger
- call the
gotMessage
method, passing it the value the other side sent you
- extract the
key
variable
The extracted key
should be the same on both ends of the connection, and an
adversary who overhead the message exchange will be unable to determine the key.
This class is not public and therefore cannot be used outside this package.
All Packages Class Hierarchy This Package Previous Next Index