Question: Assignment Requirements 1 . Key Generation ( Key Manager Program - key _ manager.py ) :RSA Key Pair Generation for Each Operator ( Alice and

Assignment Requirements1. Key Generation (Key Manager Program - key_manager.py):RSA Key Pair Generation for Each Operator (Alice and Bob):The key manager program will generate a pair of RSA public and private keys for both Alice and Bob.Saving Keys to Disk:Each RSA public and private key pair must be saved under filenames that reflect the operator's name (e.g., alice_public_key.pem, bob_private_key.pem).2. File Sending (Sender Program - sender.py):Loading the Senders Private Key and Recipients Public Key:The program will load the senders private RSA key and the recipients public RSA key from the saved files.AES/HMAC Key and IV (Nonce) Generation:Within the sender.py program, generate a random AES key, a random HMAC key, and an IV (nonce) using a secure random number generator. These values will be used for encrypting the file content and ensuring its integrity.Signing the Keys:The sender will sign the concatenated AES key, IV, and HMAC key using their private RSA key to generate a signature. This signature will later verify the authenticity of the key materials. This is called the signature.Encrypting Keys/IV using RSA:Concatenate the AES key, HMAC key, and IV, then encrypt them using the recipients RSA public key to ensure only the recipient can decrypt and access the AES and HMAC keys. Save the encrypted key material to encrypted_keys.bin.File Content Encryption using AES:Concatenate the senders name, the original file content, a timestamp (current time), and the signature. Encrypt this data using AES in CTR mode with the generated AES key and IV. We call this encrypted_message.HMAC Generation:Calculate an HMAC over the encrypted message using the generated HMAC key. Save this HMAC to a file named hmac_message.bin.Saving Encrypted Data:Save the encrypted message to a file named encrypted_message.bin.3. File Receiving (Receiver Program - receiver.py):Loading the Receiver's Private Key:The recipient (e.g., Bob) will load their private RSA key to decrypt the incoming encrypted data.Decrypting the AES Key, HMAC Key, and IV:The recipient will decrypt the AES key, HMAC key, and IV using their private RSA key from the encrypted_keys.bin file.HMAC Verification:The receiver will generate an HMAC of the encrypted file content and verify that it matches the HMAC provided in hmac.bin to confirm the integrity of the file content.File Content Decryption:Use the decrypted AES key and IV to decrypt the data, extracting the senders name, the file content, the signature, and the timestamp.Signature Verification:Load the senders public RSA key and verify the signature over the file content to ensure the integrity and authenticity of the communication.4. Testing and Validation:Both the sender.py and receiver.py programs must include test cases that demonstrate successful encryption, decryption, HMAC verification, and signature verification of the file content.Include tests that cover cases where:The HMAC verification fails (e.g., due to tampered data): adding one additional test case to cover the scenario where the encrypted_message.bin file is tampered with, leading to failed HMAC verification.The signature verification fails (e.g., due to incorrect senders public key).All verifications pass, showing that the file contents integrity and authenticity are confirmed.Use numbers (e.g. encrypted_message1.bin, encrypted_message2.bin, ...) to distinguish between different cases.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!