Encrypted Communication


The goal of this assignment is to give you practical experience in using cryptographic libraries to implement encryption functionality in your code, especially in regard to data in transit i.e. network communications.


To this end, you are provided with two pieces of code (Server.java and Client.java) written in the Java programming language. The code implements a simple socket communication program that enables two machines (a client and a server) to make a connection to each other and send messages.


Your objective in carrying out this assignment will be to modify the code to achieve the following:

• Unlimited communication between the client and the server

• Termination of the connection when a specific message is sent from the client to the server

• Encryption of the communication between the client and the server using any encryption technique




1. You will find attached the two pieces of Java programming language code that implement the socket program (One for the client side and the other for the server side).

2. You can run the program on any platform that works for you (I would suggest using Ubuntu Linux). After compiling the code, you have to assign a port number (example; Port number = 5000, you can use any port number between 2000 and 65535) to the server when putting in the command to run it. i.e.

    java Server 5000


    On the client side, you need the host name or IP address of the machine on which the server is running (if the host name or IP address is X) to run the client and connect to the server

    java client X 5000


    If you are running both programs on the same machine, the host name of the server will be localhost

    java client localhost 5000


    NOTE: A tutorial will be given to explain the details of the program and demonstrate how to compile and run the code. Please endeavor to attend the tutorial


3. The connection between the client and server closes after one message is sent, modify the codes such that multiple messages can be sent between both sides without termination.

4. Modify the code to terminate the connection when the client sends the message “End Session” to the server.

5. Modify the code such that communication between both the client and server is encrypted

6. During the communication, the terminal should display the messages received both before decryption and after decryption


NOTE: Implement any encryption technique you’ve learnt so far and use any Java language cryptographic library of your choice, preferably the one you identified in your previous assignment.

Need a custom answer at your budget?

This assignment has been answered 2 times in private sessions.

© 2020 Codify Tutor. All rights reserved