Skip to content

Commit 4d3390f

Browse files
committed
update readme
1 parent 0c7bbf2 commit 4d3390f

1 file changed

File tree

README.md

438 Bytes

Quantum Secure Email Client - Complete Setup Guide

QuMail - Quantum Secure Email Client

A comprehensive quantum-resistantsecure email client with multi-layerthat implements multiple layers of encryption including AES-256-GCM, One-Time Pad (OTP), and Post-Quantum Cryptography (PQC) using CRYSTALS-Kyber to protect against both classical and quantum computer attacks.

🏗️ Architecture Overview

This application consists of multiple components working togethertogether to provide end-to-end encryption:

  • Frontend: Flutter desktop application for Windows)
  • Backend: .NET 8 Web API withhandling authentication and email management
  • Database: PostgreSQL for user authentication and email storage
  • Crypto Services: Multiple Python services for different encryption layers
    • Key Manager (Port 2020): Manages quantum keys
    • Key Manager: Manages quantum cryptographic keys
    • OTP API: Port 2021): One-Time Pad encryption/decryption
    • AES Server: Port 2022): AES-256-GCM encryption/decryption
    • Main Backend API (Port 5001): Handles PQC operations and all email functionality
    • PQC Server: Post-Quantum Cryptography operations
    • Main Backend API: Handles all email functionality and authentication

📋 Prerequisites

Before setting up the application, ensure you have the following installed:

Python Dependencies

pip install flask flask-cors requests cryptography

🚀 Quick Start

1. Clone the Repository

git clone <repository-url>
cd Qunatum-Secure-Email-Client
cd quantum

2. Database Setup

Install PostgreSQL

  • Download and install PostgreSQL 17+ from postgresql.org
  • During installation, remember the password you set for the postgres user

Option B: Manual Setup

Step 1: Start Crypto Services

# Terminal 1 - Key Manager
# Terminal 1 - Key Manager (Port 2020)
cd Key_Manager/km
python server.py

# Terminal 2 - OTP API
# Terminal 2 - OTP API (Port 2021)
cd level1
python otp_api_test.py

# Terminal 3 - AES Server
# Terminal 3 - AES Server (Port 2022)
cd level2new
python server2.py

# Terminal 4 - PQC Server
cd level3
python pqc_server.py

Step 2: Start Backend API

# Terminal 5 - Backend API
# Terminal 4 - Backend API (Port 5001)
cd Email_client/QuMail.EmailProtocol
dotnet run
dotnet run --urls "http://localhost:5001"

Step 3: Start Frontend

# Terminal 6 - Flutter Frontend
# Terminal 5 - Flutter Frontend
cd frontend
flutter pub get
flutter run -d windows

🔧 Detailed Setup Instructions

Database Setup (Detailed)

Windows PostgreSQL Setup

  1. Download PostgreSQL installer from postgresql.org
  2. Run the installer and follow the setup wizard
  3. Set a strong password for the postgres superuser
  4. Add PostgreSQL to your PATH environment variable
  5. Verify installation:
    psql --version

Configure Backend

  1. Navigate to the backend directory:

    cd Email_client/QuMail.EmailProtocol
  2. Restore dependencies:

    dotnet restore
  3. Build the project:

    dotnet build
  4. Run the backend:

    dotnet run --urls "http://localhost:5001"
  5. Run the backend:

    dotnet run

Frontend Setup (Detailed)

Install Flutter SDK

  1. Download Flutter SDK from flutter.dev
  2. Extract to a directory (e.g., C:\flutter)
  3. Add Flutter to your PATH environment variable
  4. Verify installation:
    flutter doctor

Key Manager Service

cd Key_Manager/km
python server.py
  • Runs on: http://localhost:2020
  • Manages quantum keys for encryption
  • Stores keys in key_store.json

OTP API Service

cd level1
python otp_api_test.py
  • Runs on: http://localhost:2021
  • Provides One-Time Pad encryption/decryption
  • Requires encoder.exe in the same directory

AES Server Service

cd level2new
python server2.py
  • Runs on: http://localhost:2022
  • Provides AES-256-GCM encryption/decryption
  • Integrates with Key Manager for key exchange

Backend API Service (Handles PQC Operations)

PQC Server Service

cd level3
python pqc_server.py
  • Provides Post-Quantum Cryptography operations
  • Uses CRYSTALS-Kyber algorithm

Backend API Service

cd Email_client/QuMail.EmailProtocol
dotnet run
dotnet run --urls "http://localhost:5001"
  • Runs on: http://localhost:5001
  • Provides Post-Quantum Cryptography operations via PQCController
  • Uses CRYSTALS-Kyber algorithm
  • Handles all email functionality and authentication
  • Integrates with all crypto services

🔍 Verification & Testing

Check Service Health

# Check if all services are running
# Replace with actual URLs shown in service startup logs
curl http://localhost:5001/api/health
curl http://localhost:2020/health
curl http://localhost:2021/api/otp/health
curl http://localhost:2022/api/health
curl http://localhost:2023/health

Test User Credentials

  • Email: test@example.com
  • Password: password123

Create New User

You can create new users through the registration endpoint:

# Replace with the actual backend URL shown in startup logs
curl -X POST http://localhost:5001/api/auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "newuser@example.com",
    "password": "newpassword123",
    "name": "New User"
  }'

🚨 Troubleshooting

Common Issues

Database Connection Issues

# Check if PostgreSQL is running
pg_ctl status

# Restart PostgreSQL service (Windows)
net stop postgresql-x64-17
net start postgresql-x64-17

# Check database connection
psql -U postgres -d quantum_auth -c "SELECT version();"

Port Conflicts

If you encounter port conflicts, check what's using the ports:

# Windows - check for port usage
# Windows
netstat -ano | findstr :5001
netstat -ano | findstr :2020
netstat -ano | findstr :2021
netstat -ano | findstr :2022
netstat -ano | findstr :2023
netstat -ano | findstr :500

# Kill process by PID
taskkill /F /PID <process_id>

Flutter Build Issues

# Clean Flutter cache
flutter clean
flutter pub get

# Check Flutter doctor
flutter doctor

# Rebuild
flutter build windows
  • key_manager.log - Key Manager service logs
  • otp_api.log - OTP API service logs
  • aes_server.log - AES Server logs
  • pqc_server.log - PQC Server logs

📁 Project Structure

Qunatum-Secure-Email-Client/
quantum/
├── database/                 # Database schema files
│   ├── schema.sql           # Authentication tables
│   └── email_schema.sql     # Email tables
├── Email_client/            # .NET Backend API
│   └── QuMail.EmailProtocol/
│       ├── Controllers/     # API controllers
│       ├── Services/        # Business logic services
│       ├── Models/          # Data models
│       └── appsettings.json # Configuration
├── frontend/                # Flutter frontend application
│   ├── lib/                 # Dart source code
│   ├── pubspec.yaml         # Flutter dependencies
│   └── ...
├── Key_Manager/             # Key management service
│   └── km/
│       └── server.py        # Key Manager API
├── level1/                  # OTP encryption service
│   ├── otp_api_test.py      # OTP API server
│   └── encoder.exe          # OTP encoder binary
├── level2new/               # AES encryption service
│   ├── server2.py           # AES API server
│   └── aes_gcm_demo.exe     # AES GCM binary
├── level3/                  # PQC encryption service
│   ├── pqc_server.py        # PQC API server
│   └── pqc_server_backup.py # Backup PQC server
├── logs/                    # Service log files
├── start_server.bat         # Windows startup script
├── start_backend.bat        # Backend startup script
└── README.md               # This file

🔐 Security Considerations

Environment Variables

  • NEVER commit .env files to version control
  • Use strong, unique passwords for database access
  • Generate secure JWT secret keys (minimum 32 characters)
  • Generate unique application secret keys for each deployment
  • Rotate secrets regularly in production
  • Use environment-specific configurations
  • Consider using secret management services in production

Application Security

  • Keep all dependencies updated
  • Use HTTPS in production environments
  • Implement proper input validation
  • Monitor logs for suspicious activity

🚀 Production Deployment

Environment Setup

  1. Use environment variables for all sensitive configuration
  2. Set up proper logging and monitoring
  3. Configure reverse proxy (nginx/Apache)
  4. Enable SSL/TLS certificates
  5. Set up database replication and backups

Performance Optimization

  1. Configure connection pooling
  2. Implement caching strategies
  3. Optimize database queries
  4. Use CDN for static assets
  5. Monitor resource usage

📞 Support

Support

If you encounter issues during setup:

  1. Check the troubleshooting section above
  2. Review log files in the logs/ directory
  3. Verify all services are running on correct ports
  4. Ensure all dependencies are properly installed
  5. Check database connectivity and schema

📄 License

License

This project is licensed under the MIT License - see the LICENSE file for details.


Happy Coding! 🚀

For additional help or questions, please refer to the project documentation or create an issue in the repository.

0 commit comments

Comments
 (0)