Diffie Hellman + Karn Encryption

The Client and Server implement a simple one-way communication in two steps:

  1. A shared secret is computed using the Diffie-Hellman protocol where the public key of client and server are computed from global Diffie-Hellman p and g (that are taken from a file) and and a random number that is kept secret. The format of the key file is simple - just 20 raw bytes of data, 10 for p and 10 for g.
  2. A Karn Symmetric encryption algorithm is applied to plaintext to create ciphertext and the ciphertext is sent from the client to the server. The server decrypts and displays the plaintext. The 512 bit Karn key is obtained from the shared secret.

Operation:

  1. In the Server frame, click on the "Set Params" button. This causes the server to listen on a port number that is one higher than the one shown in the port textfield and opens a file chooser. Find the keyfile to use (download it here) and open/select it.
  2. In the Client frame, click on the "Set Params" button. This initiates the Diffie-Hellman exchange over said port, after which the server begins listening on the port shown in the textfield.
  3. In the Client frame, click on the "Connect" button to make a connection with the server on that port.
  4. Type some plain text into the plaintext textfield in the Client frame.
  5. In the Client frame click "Send".
Classes: