SENG2250 Assignment 1-System and Network Security Solved

49.99 $

Description

5/5 - (1 vote)

Aims
This assignment aims to establish a basic familiarity with network security topics via analysing, designing, and implementing solutions.

Questions
Part1: X.509 Hierarchy (36 marks)
Refer to the course Cavans Assignment 3 group for the quiz-style task “Assignment 3 – Part 1”.

Part2: Programming Task (64 marks)
A client and a server are planning to do data exchange. They decide to use a simplified SSL handshake (see Figure 1) to establish a secure channel (session key) then exchange data. The simplified SSL handshake removes the messages for alert, change cipher spec, certificate, etc.

Figure 1. Secure data exchange.

IDC: client ID; IDS: server ID; SID: session ID;
Your task: implement the above mechanism in Java (alternatively C++/Python). The following components are mandatory for implementation.
• Fast modular exponentiation (8 marks)
• RSA signature scheme. (12 marks) o RSA key generation: randomly generate two primes 𝑝𝑝, 𝑞𝑞 (for 2048-bit RSA). Set the public key as the fixed 𝑒𝑒 = 65537. Server’s RSA public key will be sent to the client in the Steup message. Assume this message can be securely delivered, no security protection is needed. Note that a client DOES NOT have its RSA keys.
o RSA signature generation: using SHA256 for message digest computation. o RSA signature verification: using SHA256 for message digest computation. o The underlying hash function is SHA256. You can use it from the Java library. o Key generation needs to be implemented using (Java) BigInteger.
o RSA signature generation and verification need to be implemented using your own fast modular exponentiation method.
• Diffie-Hellman key exchange (8 marks) o Use the parameters 𝑝𝑝, 𝑔𝑔 from the System Parameters section.
• The DH key exchange should be secure against man-in-the-middle attacks. (8 marks)
• HMAC (8 marks) o Use SHA256 as the underlying hash function. o Use the DH key (e.g., 𝑘𝑘 = 𝑔𝑔𝑥𝑥𝑥𝑥) to generate the authentication key 𝑘𝑘′, such that 𝑘𝑘′ = 𝐻𝐻(𝑘𝑘), where 𝐻𝐻() is the SHA256 hash function. o HMAC is calculated as (refer to lecture 2)
𝐻𝐻(𝑘𝑘′, 𝑚𝑚) = 𝐻𝐻((𝑘𝑘′ ⊕ 𝑜𝑜𝑝𝑝𝑜𝑜𝑜𝑜)||𝐻𝐻((𝑘𝑘′ ⊕ 𝑖𝑖𝑝𝑝𝑜𝑜𝑜𝑜)||𝑚𝑚))
• CBC mode (12 marks) o Assume a message is always a multiple of 16-byte, i.e. no padding needed.
• Data exchange (8 marks) o When a shared session key is created, they use 192-bit AES encryption with CBC and HMAC to protect data confidentiality and integrity, respectively. o Demonstrate at least two message exchanges, where each message is exactly 64 bytes.

Compilation
• Please provide a readme.txt file for compilation and execution instructions.
Input/Output
• Print (to standard input/output) all messages exchanged between the client and server.
• Use a proper output format to demonstrate the message exchange.
System Parameters
Hash function: you should use SHA256 whenever a hash function is needed.
Diffie-Hellman Key Exchange parameters (𝒑𝒑, 𝒈𝒈)
𝒑𝒑 =
17801190547854226652823756245015999014523215636912067427327445031444
28657887370207706126952521234630795671567847784664499706507709207278
57050009668388144034129745221171818506047231150039301079959358067395
34871706631980226201971496652413506094591370759495651467285569060679 4135837542707371727429551343320695239
𝒈𝒈 =
17406820753240209518581198012352343653860449079456135097849583104059
99534884558231478515974089409507253077970949157594923683005742524387
61037084473467180148876118103083043754985190983472601550494691329488
08339549231385000036164648264460849230407872181895999905649609776936
8017749273708962006689187956744210730

Notes
• Your implementation MUST be able to handle large numbers. Otherwise, 12 marks will be deducted. o Java https://docs.oracle.com/javase/7/docs/api/java/math/BigInteger.html
o C++ users should use NTL library. https://www.shoup.net/ntl/doc/tour-examples.html
• Your implementation MUST use socket programming. Otherwise, 12 marks will be deducted.
o Java tutorial https://docs.oracle.com/javase/tutorial/networking/sockets/ o C manual (This can be used with C++ with a few modifications) http://man7.org/linux/man-pages/man2/socket.2.html
o C++ tutorial (uses boost, you would want build tool to manage that, such as https://cmake.org/) https://theboostcpplibraries.com/boost.asio-network-programming o Python example and documentation https://docs.python.org/3/library/socket.html#example

FAQ
1. What is about the “Setup_Request: Hello” message?
It is just the text “Hello” that initiates the setup phase.
2. Can I use modpow() (or some function like that from the library) for the fast modular exponentiation computation?
No. You need to implement the function based on the pseudocode in Lab 2.
3. What is an identity like IDs?
It is a random character/number string of your choice, e.g., IDs=1234abcd.
4. Which is the shared session key for (CBC-AES192) encryption and HMAC?
It is 𝑘𝑘′.
5. Can I use the “CBC” encryption mode from the library?
No. You need to implement CBC encryption and decryption processes.
6. What should I send for the data exchange demonstration?
Anything, as long as exact 64 bytes of each message.
7. Can I use the external cryptography library?
Yes, but you have to implement the required components.
8. Can I reuse the code from the labs? Yes, you can.

Submission
All assignments must be submitted via Canvas. If you submit more than once, then only the latest will be graded. Your submission should be one ZIP file containing:
• All source code files
• A readme.txt for compilation/execution instructions.
• Submit your answers to Part 1 separately on Canvas.

  • A3-Part-2-syjlr9.zip