Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Ask the user for the following information: a. A port on the machine to act for incoming connections b. The name of a file

2. Ask the user for the following information: a. A port on the machine to act for incoming connections b. The name of a file containing a directory of individuals that can be contacted 3. Open Server TCP socket locally on port specified by the user 4. Load user directory (specification below) a. This is a JSON serialised dictionary format. 5. Wait for either an incoming network message or a message to be sent, typed by the user 6. If an incoming network message a. Connect to the destination using the secure protocol, which must include i. The generation of key material should be as shown below ii. Mutual authentication of the outgoing connection iii. Establishment of a secure channel using SHA256 HMAC and AES256 CBC Cryptography b. Receive Message Message format below. c. Check the control information for consistency d. Display received message to the user e. Terminate Connection

Message Formats You should use a Python Dictionary message format that can be serialised as follows: Message = { header:{ msg_type: type, crc: val, timestamp: UTC_val }, message: base64_encoded_text_message, security:{ hmac: { hmac_type: val, Type of HMAC in use, SHA256 hmac_val: val }, enc_type: val Type of encryption in use, AES256CBC } } User Directory Format You should use a Python List of Dictionaries for the directory format, which can be serialised: Directory = [ {'username': val, 'password': val, 'port': val, 'ip':' val '}, {'username': val, 'password': val, 'port': val, 'ip':' val '}, ]

Key Material Generation Once the common user secret is known and the DHSK is generated, these items should be put through a SHA256 HMAC with the user secret as the password and the DHSK as the input. DHSK | +--------+ user_secret --| HMAC | | SHA256 | +--------+ | +----- enc_key (32 bytes) | +--------+ | SHA256 | +--------+ | +----- IV (32 bytes) | +--------+ | SHA256 | +--------+ | +----- HMAC_Key (32 bytes) | +--------+ | SHA256 | +--------+ | +----- CHAP_SECRET (32 bytes) The output of the SHA256 hash (including the HMAC) will produce 32 bytes of data (represented as 64 hexadecimal characters). These outputs CAN be used directly with the cryptographic libraries in PyCryptoDome except for the IV, which must only be 16 bytes. Given SHA256 returns 32 bytes, use the first 16 bytes (0-15) of the bytes type object, which can be sliced using list slicing notation or a split function. The SAME IV is used every time a message is encrypted and decrypted

coding language:python

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Ai And The Lottery Defying Odds With Intelligent Prediction

Authors: Gary Covella Ph D

1st Edition

B0CND1ZB98, 979-8223302568

More Books

Students also viewed these Databases questions