Reference no: EM132882740
COIT13229 Applied Distributed Systems - Central Queensland University
Assignment - Java TCP networking with cryptography
Objectives
This assessment item is designed to test your understanding in Java TCP networking with cryptography, Java Object Serialization\Deserialization, light-weight remote method invocation, threading and 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-per connection) with tasks computed only on the server. The sever should connect to a relational database (Java Derby or MySql) to validate the users recorded in the database.
The client program should authenticate the users before interacting with a menu. The user name and password entered by the user should be encrypted using the public key before sending it to the server. Cryptography concepts studied in Week 5 with the supplied code should be used for the key pair generation. Only one key pair should be generated on the server and the public key should be dispatched to the client when a connection is established. The client should encrypt all the string messages before sending it to the server. The server decrypts the received message with the Private key before performing the authentication with suitable messages. The server should support multithreading to handle multiple clients concurrently (Thread-per connection). After authentication the user is provided with a menu to compute simple mathematical tasks. The tasks should only be computed on the server. The client creates an instance of the relevant task and serializes it to the server as a Task instance. The server deserializes the object and executes the task before sending it back to the client to display the result. This is not a pure remote method invocation since the object physically moves between the client and the server processes during execution. The task interface is a contract between the client and the server to reduce coupling footprint and suitable for remote deployment.
Code hints on ComputeClient:
Task t=new Fibonacci(20); out.writeObject(t);
System.out.println( ((Fibonacci)in.readObject()).getResults());
Code hints on ComputeServer:
Object obj=in.readObject(); if(obj instanceof Fibonacci){
((Fibonacci)obj).executeTask(); out.writeObject(obj);
}
Coding and Design
You can use the following class descriptions and diagram as a guideline for your design.
ComputeClient: This class prompts for a user name and password and only after authentication proceeds with the menu operations. 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. The client program can build a string with user name and password using a delimiter ":" before encryption.
Example) Encrypted message containing "John:john.123". On the server side after decryption the individual words can be extracted by using the java inbuilt String.split() method for processing.
ComputeServer: This class accepts multiple client connections. It builds the key pair and sends the Public Key to the client. The server program should be running indefinitely ready to communicate with future clients. Sample code for TCP interaction is available in moodle under Week 2.
Cryptography: This class has relevant static methods to handle cryptography without creating an instance.
DatabaseConnection: This class has relevant methods to connect to the database to authenticate users.
Task/Fibonacci/Gcd/Factorial: These are helper classes to be implemented from the UML diagram.
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.
Report
Run the program and take screenshot of program outputs for all tests with annotations. The test should demonstrate that your ComputeServer can accept connections from more than one ComputeClient.
Attachment:- Applied Distributed Systems.rar