This project presents the use of end-to-end lightweight encryption to develop a secure chat application. Implementing secure cryptographic algorithms such as RSA (Rivest-Shamir-Adleman) for key exchange and AES (Advanced Encryption Standard) for message encryption and decryption on a single board computer (SBC). This secure chat application provides real-time password-protected communication with an intuitive user interface enabled with avatar depictions and emoticons, built with Flask and Socket.IO. Performance metrics such as memory usage and latency are logged to evaluate server efficiency of the SBC Raspberry Pi 5. Integrating cryptographic algorithms on a Raspberry Pi 5 offers security solutions for industries in need of secure communication. One of the major challenges in developing this secure chat application is implementing efficient encryption and decryption mechanisms. Managing RSA key exchange between the server and the client requires careful handling to ensure compatibility across different cryptographic libraries and platforms. Additionally, optimizing AES encryption for real-time message processing poses another challenge, as it is important to maintain a balance between strong security and minimal latency to provide a seamless user experience.
A real-time secure chat application with end-to-end encryption, designed specifically for deployment on single-board computers like the Raspberry Pi 5. This project demonstrates the implementation of robust cryptographic protocols in a lightweight, resource-constrained environment.
- RSA Key Exchange: 2048-bit RSA encryption for secure key distribution
- AES Message Encryption: AES-CBC mode for end-to-end message encryption
- Password Protection: Simple password authentication (123456)
- Session Key Management: Dynamic session key generation and distribution
- Real-time Communication: WebSocket-based instant messaging
- User Management: Join/leave notifications and participant tracking
- Avatar System: Automatic avatar generation using RoboHash
- Emoji Support: Built-in emoji picker for enhanced communication
- Message Timestamps: Full timestamp tracking for all messages
- Modern Design: Glassmorphism UI with gradient backgrounds
- Responsive Layout: Optimized for various screen sizes
- Dark Theme: Eye-friendly dark mode interface
- Real-time Updates: Live participant list and message updates
- Flask-SocketIO: Real-time bidirectional communication
- PyCrypto: Cryptographic operations (RSA, AES)
- Performance Monitoring: Built-in metrics collection
- Memory usage tracking
- CPU utilization monitoring
- Network bandwidth measurement
- Latency calculation
- Energy consumption estimation
- Socket.IO Client: Real-time communication
- Forge.js: Client-side cryptographic operations
- Bootstrap: Responsive UI framework
- Font Awesome: Icon library
pip install flask flask-socketio pycryptodome psutil
python server.py
The application will be available at http://localhost:5000
- Open the web interface in your browser
- Enter a username and password (123456)
- Click "Join" to enter the chatroom
- Start sending encrypted messages!
The application tracks comprehensive performance metrics:
- Decryption Time: Time taken to decrypt each message
- Latency: Network delay between client and server
- Throughput: Messages processed per second
- Memory Usage: Server memory consumption
- CPU Usage: Processor utilization percentage
- Network Bandwidth: Data sent/received statistics
- Energy Consumption: Estimated power usage
- Client generates RSA key pair (2048-bit)
- Client sends public key to server
- Server encrypts session key with client's public key
- Client decrypts session key using private key
- Both parties use shared session key for AES encryption
- Client encrypts message with AES-CBC using session key
- Encrypted message sent to server
- Server relays encrypted message to all clients
- Each client decrypts message using their session key
- RSA Implementation: Understanding public-key cryptography
- AES Encryption: Symmetric encryption for bulk data
- Key Management: Secure key exchange and distribution
- End-to-End Security: Ensuring message confidentiality
- WebSocket Communication: Bidirectional real-time data flow
- Event-Driven Architecture: Handling multiple concurrent connections
- Client-Server Synchronization: Managing state across multiple clients
- Resource Monitoring: Tracking system performance metrics
- Lightweight Implementation: Optimizing for constrained environments
- Scalability Considerations: Handling multiple concurrent users
- Raspberry Pi Optimization: Adapting applications for ARM architecture
- Resource Management: Efficient use of limited CPU and memory
- Network Performance: Optimizing for embedded network capabilities
This project demonstrates the practical implementation of enterprise-grade security protocols on resource-constrained hardware, making it valuable for:
- IoT Security: Secure communication in embedded systems
- Educational Purposes: Learning cryptography and real-time web development
- Proof of Concept: Demonstrating security feasibility on SBCs
- Industry Applications: Secure communication solutions for small-scale deployments
secure-chat-raspberry-pi-server/
āāā server.py # Flask server with SocketIO and encryption
āāā static/ # Static assets (CSS, JS, images)
āāā templates/ # HTML templates
ā āāā index.html # Frontend chat interface
āāā docs/ # Documentation
ā āāā ABSTRACT.md # Project abstract
ā āāā presentation.pdf # Project presentation
āāā README.md # This file
- User authentication with database
- Message persistence and history
- File sharing capabilities
- Group chat rooms
- Mobile app development
- Advanced security features (perfect forward secrecy)