The Encrypted Chat System is a Java-based application that provides secure messaging functionalities using the Advanced Encryption Standard (AES) algorithm. It enables users to register, authenticate, create and join chat rooms, send encrypted messages to multiple users, and switch between active users. The system incorporates design patterns such as Strategy and Singleton to manage encryption strategies efficiently and ensure single-instance managers, respectively.
-
User Management
- User registration with a unique username, password, and private key.
- User authentication to verify credentials before allowing access.
- Switching between active users for multi-user testing.
-
Chat Room Management
- Creation of new chat rooms.
- Joining existing chat rooms by room number.
- Listing all chat rooms and users within a specific room.
-
Secure Messaging
- Encryption and decryption of messages using AES encryption.
- Sending encrypted messages to multiple users within a chat room.
- Reading and displaying decrypted messages for individual users.
-
Design Patterns
- Strategy Pattern: Implements different encryption strategies (currently supports only AES).
- Singleton Pattern: Ensures a single instance of the ChatRoomManager and EncryptionManager.
The application currently supports the AES encryption strategy for encrypting and decrypting messages. The AESEncryptionStrategy
class implements the EncryptionStrategy
interface, providing methods to encrypt and decrypt messages using AES with ECB mode and PKCS5 padding. The EncryptionStrategyFactory
class facilitates the creation of encryption strategies based on the specified type (e.g., "AES").
The ChatRoomManager
class is implemented as a Singleton and manages the creation and retrieval of chat rooms. Each chat room (ChatArea
) maintains a list of users, messages, and message observers. Users can join chat rooms, send messages to multiple users, and read messages sent to them.
-
Registration and Authentication
- Users can register with a unique username, password, and private key.
- Authentication ensures that only registered users can access the system.
-
Creating and Joining Chat Rooms
- Users can create new chat rooms.
- Existing chat rooms can be joined using the room number.
-
Sending and Receiving Messages
- Messages are encrypted before sending using AES.
- Decryption of messages allows users to read the original content.
-
Switching Users
- Active users can switch to other registered users after authentication.
- Java 8 or higher
- Java Cryptography Extension (JCE) for AES encryption
To run the Encrypted Chat System:
- Clone the repository to your local machine.
- Compile and run the
EncryptedChatSystem.java
file using a Java compiler. - Follow the on-screen instructions to navigate the application and test its functionalities.
- Support for additional encryption algorithms (e.g., RSA).
- Implementing a graphical user interface (GUI) for better user experience.
- Adding error handling and validation to improve robustness.
Contributions to the Encrypted Chat System are welcome! Please fork the repository, make your changes, and submit a pull request for review.
This project is licensed under the MIT License. See the LICENSE
file for more details.
For any questions or feedback, please contact [Seif Elredeini]](info@seifelredeini.com).