Due Date: March 27th, 2007.
This assignment demonstrates the use of previously developed library functions to implement a cryptographic protocol. In particular, you will be required to use the Gnu multiprecision and crypto libraries to implement Diffie-Hellman (Hughes variant) based secure file transfer. Note that this assignment is significantly more difficult than it may seem at first. Do not attempt to do this work in the last few days before the assignment is due.
Follow these instructions
Obtain the tarfile from here.
Unpack the tarfile in some appropriate directory on a UNIX system (there are many available at CSE -- see Notes below).
You are to implement a secure file transfer program that communicates a file between the client and server. The idea is that the client encrypts the file using the Hughes variant of Diffie-Hellman that you developed in the last project, and sends the encrypted file to the server. The server (the part that you are building) must: (1) complete the DH-Hughes exchange with the client; (2) decrypt the file using the resultant key; and (3) return the decrypted file to the client. You are given the protocol client implementation and required to complete the following tasks:
Replace the current appcrypto implementation with the one you completed for the last assignment. (see note below).
Implement the server side of the protocol given the implementation of the client side. Reverse engineering the server implementation from the client is the recommended approach (note: protocol is not symmetric, however).
Document the key exchange and file transfer messages implemented in the complete protocol. Provide a diagram (complete with cryptographic notation).
To run the server, simply run the executable (called
cse497b-p3-server) on the same machine you are using
(with no command line parameters). The client program's (called
cse497b-p3) command line should be apparent from the
code. You will need to complete the implementation of the
following functions (all in cse497b-proto.c):
int serverDoDH( int sock, mpz_t p, mpz_t g )
int serverDoHughes( int sock, mpz_t p, mpz_t g, mpz_t key )
int transferFile( char *fname, int sock,
gcry_cipher_hd_t *cipher, int xferFlag )
int serverDHTransfer( void )
When you have completed the code, email it to the course professor by 5:00pm on the 27th. Please attach a tar file containing all the original source, your documented protocol file, plus your additions. Failure to compile or execute properly will likely result in a failing grade for the assignment. You will also need to hand in your documentation for the protocol implemented.
You should to replace the initAppCryptoLibrary
function from the original appcrypto with the one in the tarfile.
If you are using the Solaris systems in Lab 222 (don't bother with 218), then you will need to do some things:
Add some libraries to the LIBS definition in the Makefile. In particular "-lsocket" and "-lnsl" must be added. New line should be: LIBS=-lgmp -lgcrypt -lsocket -lnsl -l$(CSE497BLIB) -l$(UTILLIB)
All the machines in this lab use the same IP address, so you will need to change the port of your server (or you will find that you may be communicating with someone else). This is defined by DH_PROTOCOL_PORT and it should not conflict with service port numbers.
You are to complete this on your own. Any sharing of code or help during the coding of this project is expressly forbidden. Do not discuss this project with anyone.
A Makefile has been created to help you build the applications. To build, simply type "make" in the target directories.
gcrypt library -- As part of this assignment, you will be required learn and use the GNU cryptography library. Details of this library are presented in the manual. Do not contact the professor or TA (or anyone else) for information about this library -- learning how to use it is part of the exercise.
Here is example output for the client and server. Note that I only print the DH parameters in the client output.