Giter Site home page Giter Site logo

modothprav / secure-channel-java Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 66 KB

A Java Secure Channel implementation that uses elements from the Java Cryptography Extension.

Java 100.00%
java encryption-decryption java-cryptography-extension secure-communication hacktoberfest hacktoberfest-accepted hacktoberfest2022

secure-channel-java's Introduction

Secure Channel Echo Server and Client

The objective of this project was to implement a secure communications channel. Asymmetric encryption, signatures and key management in Java will be utilised to implement a secure protocol.

The project is divided into three sections, with each section built on top of the previous solution. The first section introduces asymmetric encryption, the second introduces key management and finally the third combines the previous two to implement a secure protocol.

The project consists of an Echo Server and a Client program. The server will just echo back the messages recieved back to the client. Howerver, the messages that are passed over the communication channel will be encrypted.

How to run

Section One: Asymmetric Encryption

Step 1: Navigate to src

Open two terminals and nivigate to the the src folder of the project in both of the terminals.

cd src

Step 2: Compilation

Compile the following files in one of the terminal sessions.

javac Part1/EchoServer.java Part1/EchoClient.java Part1/Util.java

Step 3: Run Client and Server Program

Run the server program on one terminal and client program on the other

java Part1.EchoServer
java Part1.EchoClient

The following output should be observed

image

Step 4: Exchange Public Keys

First paste the Client Public key onto the server's terminal and press enter so the server starts listenning for connections. Then paste the Server public key onto the client's terminal.

image

Step 4: Send Messages

Once the Server Public key is pasted onto the client's terminal, press enter to prompt the client to send messages to the server.

The following output should be observerd.

image

Section Two: Key management

The keys were generated using the keytool command which comes with the JCE. The client and server keys were created with same key password for testing purposes. The following commands shown below were used to generate the keys.

keytool -genkey -alias client -keyalg RSA -keystore cybr372.jks -storepass badpassword -keypass password -storetype JKS
keytool -genkey -alias server -keyalg RSA -keystore cybr372.jks -storepass badpassword -keypass password -storetype JKS

Step 1: Navigate to src

Open two terminals and nivigate to the the src folder of the project in both of the terminals.

cd src

Step 2: Compilation

Compile the following files in one of the terminal sessions.

javac Part2/EchoServer.java Part2/EchoClient.java Part2/Util.java

Step 3: Run Program

java Part2.EchoServer <storePassword> <keyPassword>
java Part2.EchoClient <storePassword> <keyPassword>

Run the server program on one terminal and the client program on the other. Will also have to specify the store password (badpassword) and the key password.

Note: Ensure that the server program is run first so it's listening for incoming connections.

The following output should be observed.

image

Section Three: Secure Channel

This sections uses asymmetric encryption for messages regarding key negotiation and once the symmetric keys are generated, symmetric encryption will be used for future messages. This continues until a max message limit is reached where key negotiation occurs again if there are more messages to be sent and received.

Step 1: Navigate to src

Open two terminals and nivigate to the the src folder of the project in both of the terminals.

cd src

Step 2: Compilation

Compile the following files in one of the terminal sessions.

javac Part3/EchoServer.java Part3/EchoClient.java Part3/Util.java

Step 3: Run Program

java Part3x.EchoServer <storePassword> <keyPassword> [maxMessages]
java Part3.EchoClient <storePassword> <keyPassword>

Run the server program on one terminal and the client program on the other. Will also have to specify the store password (badpassword) and the key password. The key password for both the client and server is password, for simplicity and testing purposes.

When running the server program, the user can also specify the number of maximum messages that can be received before key negotiation has to be performed again. If not specified this value will be set to 5.

Note: Ensure that the server is ran first and listening for connections.

The following output should be observed.

image

image

secure-channel-java's People

Contributors

modothprav avatar

Watchers

 avatar

Forkers

nathan-r1

secure-channel-java's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.