This assessment item is designed to test your understanding in Java TCP networking with cryptography, Java Object Serialization\Deserialization, threading, connecting to a relational database.
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-per- connection). 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.
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): see image.
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.
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 screenshot: see image.
Server screenshot: see image.
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.