Due Date: October 12th, 2010.
This assignment demonstrates the use of the <\b>gcrypt library functions to implement a cryptographic protocol. In particular, you are to build public key pairs to encrypt and authenticate messages that can be decrypted and verified.
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 will need to get the gcrypt library (and its dependencies) if the machine does not have it installed already.
You task is to implement three (3) functions: (1) GenerateKeyPair; (2) SealMessagePK; and (3) GetMessagePK. There are comments in the files to guide you to implement the proper functionality.These functions must complete the following tasks:
GenerateKeyPair uses gcrypt library functions to generate a key pair (public and corresponding private key). This function takes two inputs: the names of the files to store the public and private keys. Please use the provided functions to store the keys in these files. You will need to generate two key pairs -- one for the sender and one for the receiver.
SealMessagePK uses the gcrypt library functions to encrypt a message (file with this message is supplied as input) and construct a signature. Comments in this function specify the necessary steps.
GetMessagePK uses the gcrypt library functions to decrypt and verify messages. Write the decrypted message into supplied file name. Comments in this function specify the necessary steps.
You have some leeway about what format to store the encrypted data and signature. I stored the S-expressions directly, but you can extract the data. My only requirements are: (1) that encrypted data and signatures are generated and (2) that I can use the sequence of commands below to encrypt, sign, decrypt, and verify the provided data.
I aim to test your code by running the following four commands with my own input data (no more than 100 bytes). This emulates a sender generating an encrypted, signed message that is then decrypted and verified by a receiver.
./cse543-p2 1 privkey1-filename pubkey1-filename
./cse543-p2 1 privkey2-filename pubkey2-filename
./cse543-p2 2 input-file privkey1-filename pubkey2-filename encryptedfile-prefix
./cse543-p2 3 encryptedfile-prefix privkey2-filename pubkey1-filename plainfile-prefix
When you have completed the code, test it by encrypting some files and decrypting the contents. I will provide a drop box for submitting this project. The project is due on October 12 at 11:59pm. Please attach a tar file containing all the source, including your additions. You can build this tar file using the command make tar from the source directory.
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 anyone else) for information about this library -- learning how to use it is part of the exercise.