Recent Question/Assignment

COIT132229 Applied Distributed Systems
Assignment 2 – Java TCP networking with cryptography
Due date: Week 11 Friday (29th May 2019) 11:45 PM AEST ASSESSMENT
Weighting: 35% 2
Objectives
This assessment item is designed to test your understanding in Java TCP networking with cryptography, Java Object SerializationDeserialization, threading, connecting to a relational database.
Assessment task
The application should be implemented as a client/server model using java TCP sockets. The server program should have the capability to concurrently handle multiple client connections (Thread-perconnection). The sever should persist data to a relational database (Java Derby or MySql). Before running the TCPServer the database named “admin” should be manually created without a username and password. The provided SQL script(“administrator.sql”) should be used to create two tables with sample records. The client menu should handle only administrator options (1. Current Admin 2. New Admin 3. Exit). Server validated messages displayed on the client include (Admin exists, Un-registered Admin, Invalid Password, Welcome or Admin Created). Only after the user is registered or authenticated with a welcome user message the client should proceed to display another sub-menu (3. Report Log Summary 4. Delete User Log 5. Root Menu). The report option displays listings in a tabular format on the client console which includes three fields (Student number, total number of visits and total cost). Each visit is charged a flat fee of $3.50. The delete option deletes the log details for a specific student number. SQL queries should be designed with prepared statements to handle these requests with the database. Cryptography concepts studied in Week 6 with supplied code should be used for the key pair generation. Key pair should be generated on the server and once a connection is established with the client the generated Public Key is sent to the client. All the string messages from the client should encrypted with the Public Key before sending it to the server. The server decrypts with the Private key before performing the validation and database transactions with suitable messages.
Coding and Design
You can use the following class descriptions and diagram as a guideline for your design.
(At minimum three java files should be used).
TCPClient: This class handles the data entry with suitable menus. Any string message sent to the server should be encrypted with the public key. The program should allow the client to enter the details for multiple entries. Client user selection String built before encryption. Example) “1 sydneyuser sydney.123” current admin with username sydneyuser and password sydney.123 space separated. On the server side after decryption individual words can be extracted by using the string split method for processing.
TCPServer: This class accepts multiple client connections. It builds the builds the key pair and sends Public Key to the client. The server program should be running indefinitely ready to communicate with future clients.
Cryptography: This class has relevant static methods to handle cryptography.
DatabaseConnection: This class has relevant methods to transact with the database.
Figure 1(Design)
Your program should check user inputs for potential error and allow user to re-enter details where appropriate. Exception and error handling should be implemented within your program where necessary. The source code should be formatted properly following good programming practice (appropriate variable names, indentation, comments, etc.…)
Note: User defined class Connection shares the same name as inbuilt Connection class in java.Sql library, be explicit in declaration as shown in Figure1 to distinguish them. Ensure relevant jar file is added before connecting to the database.
Sample Screenshots
The following screenshots show example outputs of the above program. You should only use these as references. Your program outputs can be similar but not necessarily the same. The tests below assume that TCPClient is run on two Java Virtual Machines.
Client 1 Client 2
Output of TCPServer:
Report
Include an end user instruction and test manual with the compilation steps and order of running the programs. Run the program and take screenshot of program outputs for all tests with annotations. The test should demonstrate that your TCPServer can accept connections from more than one TCPClient.
Assessment Submission
You should submit one Zip file containing the following files using the Moodle online submission system, by the due date:
• TCPClient.java – Source code for the TCPClient class
• TCPServer.java – Source code for the TCPServer class
• Connection.java – Source code Connection class
(This class can also be provided inside TCPServer.java as an inner class)
• DatabaseConnection.java – Source code DatabaseConnection class
(This class can also be provided inside TCPServer.java as an inner class)
• Cryptography.java– Source code for the Cryptography class
• Report.docx – A document file containing details as outline above.
Note:
1. If your program doesn’t compile or run, partial marks will be allocated by inspection of the source code.
2. Your understanding of the program will be examined using your report and the detailed java doc comments inserted in your source code files.
3. Please clarify any doubts you have by one of the means of discussing with your tutor, posting a query in the Q& A forum, or discussing with your colleagues or contacting the unit coordinator.
4. Please do not share your source code files or report with your colleagues which may lead to plagiarism.
Assessment Item 2 Marking criteria
S. No Total Marks – 30 Marks Allocated Marks Scored
1 1.The Client class enabling send/receive Strings.
2.Appropriate data entry and handling of root and sub menus for new and existing admin users.
3.Receives public key from server.
4.Sent messages are encrypted. 8
2 1.The Server class accepts client request.
2.Multithreading (thread per client).
3.Generation of key Pair and sending public key.
4.Decrypting messages before processing. 8
3 Client displays correct interaction messages.
1.Admin Exists 2. Un-registered Admin 3. Invalid Password. 4. Welcome Admin
5. Admin Created. 5
4 1.Database tables structures are correct.
2.Query to check/insert user to user table.
3.Query to report/delete from log table. 6
5 Connection and Cryptography classes with relevant methods. 2
6 Good coding practices (Indentation,
Comments, Naming Conventions, Readability) 2
7 Well-presented report, detailed user manual. 2
8 Screen shots of running programs to cover all tests. 2
Sub-total 35
Penalties
Late penalty -1.75 (5% per
Calendar day)
Plagiarism As per policy
Total 35