-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.txt
More file actions
107 lines (64 loc) · 2.5 KB
/
README.txt
File metadata and controls
107 lines (64 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
Chat Client & Server
This project is a lightweight encrypted chat application that allows multiple users to connect to a server over a network and exchange messages securely. All communication is encrypted using AES with PBKDF2 key derivation.
Features:
Client–server architecture using sockets.
AES-encrypted messaging using the CryptoUtil class.
Multi-client support with broadcast messaging.
Works on localhost or LAN networks.
Cross-platform as long as Java is installed.
---------------
Encryption Overview:
This project uses the CryptoUtil.java class to encrypt and decrypt all messages before they are transmitted.
Encryption details:
Algorithm: AES
Mode: CBC
Padding: PKCS5Padding
Key Derivation: PBKDF2WithHmacSHA256
Key Size: 256 bits
Iterations: 65536
IV: Random 16-byte IV prepended to ciphertext
This ensures confidentiality and prevents predictable ciphertext.
---------------
How to Run:
Start the Server
Compile and run:
javac ChatServer.java
java ChatServer <port>
2. Start a Client
Compile and run:
javac ChatClient.java
java ChatClient <server-ip> <port>
3. Adding Multiple Clients
To add multiple clients to the same server, simply run the ChatClient.java again.
(java ChatClient <server-ip> <port>)
---------------
How It Works:
The client connects to the server using a socket.
Before sending any message, the client encrypts it using CryptoUtil.encrypt().
The server receives the encrypted message and broadcasts it to all connected clients.
Each client decrypts incoming messages using CryptoUtil.decrypt().
---------------
Requirements:
Java 8 or later
Network or localhost environment
Shared password (hardcoded in CryptoUtil)
---------------
Security Notes:
The shared password and salt are currently hardcoded. For production use, consider:
Secure key exchange (such as Diffie-Hellman)
Environment variables
External configuration files not stored in version control
This project is intended for learning and local experimentation, not production-grade secure messaging.
---------------
License:
Java Chat Server © 2025 by The-R34per is licensed under Creative Commons Attribution-
NonCommercial-ShareAlike 4.0 International. To view a copy of this license, visit
https://creativecommons.org/licenses/by-nc-sa/4.0/
AI Assistance Attribution:
Portions of this project were developed with help from Microsoft Copilot and ChatGPT.
---------------
Contributions:
Suggestions and improvements are welcome. Feel free to fork the project and build on it.