Skip to content
/ SSL Public

A simple Java-based SSL client-server application demonstrating secure socket communication for educational purposes.

Notifications You must be signed in to change notification settings

shaina-gh/SSL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Secure Client-Server Communication using SSL

This project demonstrates a simple SSL (Secure Sockets Layer) based client-server application in Java. It ensures secure communication between a server and a client by encrypting the transmitted data using Java’s built-in SSL capabilities.

πŸ”’ Project Overview

This application sets up a server that listens over SSL and a client that connects securely to it. Both sides exchange messages over an encrypted channel, providing confidentiality and integrity.


πŸ› οΈ Setup & Execution

Step 1: Prerequisites

  • Java JDK (8 or later)
  • VS Code with Java Extension Pack (recommended)
  • Terminal access

Step 2: Generate Keystore

The keystore is required by the server to authenticate itself.

keytool -genkeypair -alias serverkey -keyalg RSA -keysize 2048 -keystore serverkeystore.jks -validity 365
Keystore password: password

You can leave other prompts as default or fill in accordingly.

Step 3: Compile the Code

Navigate to the project directory and run:

javac SSLServer.java SSLClient.java

Step 4: Start the Server

java SSLServer

The server will listen for incoming SSL connections on port 4444.

Step 5: Run the Client (in another terminal)

java SSLClient

Upon successful connection, messages will be exchanged securely.


🧠 Key Concepts

SSLContext: Sets up the secure socket layer configuration.

Keystore: Stores the server's private key and certificate.

TrustManager: Used on the client side to accept the server’s certificate (here, it accepts all for demo purposes).

Encrypted Communication: All data between client and server is encrypted using SSL.

πŸ“Œ Important Notes

This project is for educational purposes. The client blindly trusts all certificates, which is not recommended for production use.

For real applications, validate server certificates properly using a TrustStore.

πŸ“· Output (Sample)

Server terminal:

SSL Server is running on port 4444
Client: Hello from Client

Client terminal:

Server: Hello from Server

About

A simple Java-based SSL client-server application demonstrating secure socket communication for educational purposes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages