In Part 1, you will use network sockets to transfer a file between hosts. To simplify operation, the client will read a file from STDIN and the server will “save” the file to STDOUT.

computer science

Description

Part 1 : Unencrypted File Transfer (uft)
In Part 1, you will use network sockets to transfer a file between hosts. To simplify operation, the client will read a file from STDIN and the server will “save” the file to STDOUT. You must use the same program for both the client and the server and conform to the following command line options:

uft [-l PORT] [DESTINATION PORT] 
For example, the following is an example execution.

[client]$ ./uft server.add.ress 9999 < some-file.txt

[server]$ ./uft -l 9999 > some-file.txt
Both programs must terminate after the file is sent.

Important: All parts of this assignment must work for both small and big files, both text based and binary based. I recommend trying first with a simple text file and then testing with a PDF before submitting.

Tip: I recommend using a fixed size “header” containing the size of the message being sent. While it may not be needed for Part 1, it will be useful for Part 2 when you need to read a full message before decrypting. Debugging this in Part 1 will simplify your effort on Part 2.

Part 2 : Encrypted File Transfer (eft)
In Part 2, you will extend uft with symmetric encryption and integrity verification using AES and the Galios Counter Mode (AES-GCM) mode of operation. Recall that GCM avoides the need to incorporate integrity into the cryptographic protocol (e.g., Encrypt-then-MAC).

To perform the encryption, you will use PyCryptodome. Note that PyCryptodome is a drop-in replacement for PyCrypto, which does not support GCM. Unfortunately, most systems provide PyCrypto instead of PyCrypto, so you may need to read the installation instructions. The documentation for PyCryptodome has several useful examples, but you will likely need to read the API documentation, specifically for using GCM.

You must:

Use AES-256 in GCM mode
Compute the key from the command line argument using PBKDF2 (Password-Based Key Derivation Function), which is available in PyCryptodome. Note that that using PBKDF2 requires a salt, which is a securely generated random value. Both the client and server need to use the same salt; therefore, your connection should start with the client sending the salt to the server. This initial exchange will also get you ready for Part 3.
To successfully decrypt the data, the server must receive the IV (“nonce” in the GCM API) from the client.
You must use the same program for both the client and the server and conform to the following command line options:


Instruction Files

Related Questions in computer science category