A modern, privacy-focused Peer-to-Peer (P2P) secure messaging and file transfer application built in Java with end-to-end encryption.
- Overview
- Features
- Architecture
- Security
- Installation
- Usage
- Project Structure
- Technology Stack
- Screenshots
- Contribution & Feedback
- Gratitude
P2P is a hybrid peer-to-peer communication system designed to provide secure, decentralized messaging without relying on centralized servers to store user data or messages. Unlike traditional messaging platforms (WhatsApp, Telegram) that maintain metadata and message logs on central servers, P2P facilitates direct encrypted connections between users while using a lightweight Discovery Server solely for peer lookups.
- Privacy First: No central authority stores your conversations
- User Control: Direct peer-to-peer connections for all communications
- Modern Design: Beautiful glassmorphic UI built with Java Swing
- Secure by Default: End-to-end encryption on all messages and files
- Real-time text messaging between peers
- End-to-end encrypted conversations using RSA-2048 and AES-256
- Message notifications and delivery status
- User presence tracking with online/offline status
- Peer discovery without exposing sensitive information
- Secure file sharing with robust protocol handling
- Large file support with fragmentation and reassembly
- Complex filename support with dynamic protocol adaptation
- Progress tracking for file transfers
- Integrity verification of transferred files
- Glassmorphic design for modern aesthetics
- Responsive UI with smooth animations
- Cute custom components (buttons, text fields, progress bars)
- Chat bubble visualization for message display
- File preview and management
- Customizable theme support
- RSA-2048 asymmetric encryption for key exchange
- AES-256 symmetric encryption for message and file transfer
- Hybrid cryptosystem for optimal security and performance
- No message or file data passes through the central server
- Session-based encryption with secure key management
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Discovery Server (Central) β
β (Peer Registration & Lookup Only) β
ββββββββββββ¬βββββββββββββββββββββββββββββ¬βββββββββββββββ
β β
βββββββΌββββββ ββββββββΌβββββββ
β Peer A βββββββββββββββ Peer B β
β Direct P2Pβ Connection β Direct P2P β
β (Encrypted) (Encrypted) β
ββββββ¬βββββββ ββββββββ¬βββββ
β β
ββββββΌβββββββββββββββββββββββββββββββΌβββββ
β Messages & Files Transferred β
β Directly Between Peers (E2E Encrypted)β
βββββββββββββββββββββββββββββββββββββββββββ
- DiscoveryServer - Central server for peer registration and lookup
- PeerNode - Individual peer client with networking capabilities
- SecurityUtils - Cryptographic operations (RSA/AES)
- MainFrame - Primary UI container
- Custom UI Components - Glassmorphic design elements
1. Peer A generates RSA key pair and shares public key
2. Peer B generates RSA key pair and shares public key
3. Both peers exchange AES session keys encrypted with RSA
4. RSA is used only for initial handshake (computationally expensive)
1. After key exchange, all messages use AES-256 encryption
2. Fast symmetric encryption suitable for large data streams
3. Session-specific keys ensure conversation privacy
- β Confidentiality: Messages visible only to sender and recipient
- β Integrity: No message tampering without detection
- β Forward Secrecy: Session keys are ephemeral
- β No Server Access: Discovery server never sees encrypted content
- Java Development Kit (JDK) 11+
- Apache Maven (optional, for building)
- Git (for cloning the repository)
chmod +x build.sh
./build.shbuild.batjavac -d bin -sourcepath src $(find src -name "*.java")java -cp bin p2p.net.DiscoveryServerThe server will start on port 8888 and wait for peer connections.
java -cp bin p2p.App- Enter your username when prompted
- The application will automatically:
- Generate RSA key pair for secure communication
- Register with the Discovery Server
- Start listening for incoming peer connections
- Connect with other peers and start messaging
- Peer List Panel: Shows available peers for connection
- Chat Panel: Displays conversation with selected peer
- Message Input: Type messages and press Send
- File Transfer: Use file buttons to share documents
- Status Indicators: Green = Online, Gray = Offline
p2pv0/
βββ README.md # This file
βββ P2P_Project_Case_Study.md # Detailed technical documentation
βββ build.sh # Linux/macOS build script
βββ build.bat # Windows build script
βββ 1p2p.png # Application screenshot 1
βββ 2p2p.png # Application screenshot 2
βββ src/
βββ p2p/
βββ App.java # Entry point & application launcher
βββ TestRunner.java # Unit tests & test cases
βββ net/
β βββ DiscoveryServer.java # Central peer discovery service
β βββ PeerNode.java # Individual peer implementation
βββ security/
β βββ SecurityUtils.java # Cryptographic utilities (RSA/AES)
βββ ui/
βββ MainFrame.java # Main application window
βββ ChatBubblePanel.java # Message bubble display
βββ FileBubble.java # File transfer visualization
βββ Theme.java # UI theme management
βββ GlassPanel.java # Glassmorphic effect panel
βββ CuteButton.java # Custom button component
βββ CuteTextField.java # Custom text input
βββ CuteProgressBar.java # Custom progress indicator
βββ CuteFileButton.java # Custom file selector button
| Category | Technology |
|---|---|
| Language | Java 11+ |
| Networking | Socket Programming (TCP) |
| Encryption | RSA-2048, AES-256 |
| UI Framework | Java Swing |
| Design Pattern | Hybrid P2P Architecture |
| Concurrency | Java Threads, ExecutorService |
| Data Format | Base64 encoding for encrypted data |
The application's main window showing the modern glassmorphic UI design with peer list and active chat.
File transfer interface demonstrating secure file sharing capabilities.
User A Types Message
β
Message Encrypted with AES-256
β
Message Sent via Direct TCP Connection to Peer B
β
Peer B Receives & Decrypts Message
β
Message Displayed in Peer B's UI
User Selects File
β
File Split into Chunks
β
Each Chunk Encrypted with AES-256
β
Chunks Sent via Direct P2P Connection
β
Recipient Receives & Reassembles Chunks
β
File Decrypted & Saved Locally
Project Authored by: Shivam Kumar
Team Members:
- Tushar
- Saurabh
- Shreya
Built with open-source community ideas and contributions.
We welcome contributions and suggestions from the community! Whether you want to:
- Enhanced peer discovery mechanisms
- Voice/video calling capabilities
- Group messaging support
- Message history with local encryption
- Mobile client support
- Additional cryptographic algorithms
- Performance optimizations
- Security vulnerabilities
- UI/UX improvements
- Performance bottlenecks
- Documentation enhancements
- Bug fixes and edge cases
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure your code follows the project's coding standards and includes appropriate tests.
We express our heartfelt gratitude to:
- The Open Source Community for their invaluable tools, libraries, and inspiration
- All Contributors who help improve this project through code, feedback, and ideas
- Security Researchers who help us maintain the highest security standards
- Early Adopters who test and provide feedback on the application
- You for taking the time to explore this project!
This project represents months of research, development, and refinement. It combines cryptographic theory, distributed systems design, and modern UI principles. We're proud to share it with the community and look forward to its evolution.
This project is developed as part of an academic case study and open-source initiative. Please refer to the project's license file for usage terms.
For questions, suggestions, or collaboration opportunities:
- Review the case study: Check
P2P_Project_Case_Study.mdfor detailed technical documentation - Explore the code: Well-commented source files in
src/directory - Run tests: Execute
TestRunner.javafor validation
- Group messaging (n-to-n encrypted conversations)
- Voice and video calling with WebRTC
- Message history with local database encryption
- Mobile client (Android/iOS)
- GUI improvements and theme customization
- Performance optimization for large file transfers
- Advanced privacy features (message expiration, disappearing messages)
- Network resilience improvements
If you find this project helpful, please consider:
- β Starring the repository
- π’ Sharing with friends and colleagues
- π Reporting issues and suggesting improvements
- π€ Contributing code and enhancements
Thank you for being part of the P2P revolution! π
Last Updated: December 7, 2025
We warmly welcome anyone who wants to suggest features, report bugs, or contribute to this project. Whether you're a cryptography expert, UI designer, networking specialist, or enthusiast with ideasβwe'd love to hear from you! Together, we can make P2P even more secure, efficient, and user-friendly. Join us in building the future of decentralized communication! πβ¨

