CIA/e-voting-system
Alexis Bruneteau b1103a420a fix: Comprehensive ElGamal encryption system - DRY & KISS principles
Major improvements applying DRY (Don't Repeat Yourself) and KISS (Keep It Simple, Stupid):

BACKEND CHANGES:
- Fixed public key storage: Store as base64-encoded bytes in LargeBinary column (not double-encoding)
- ElGamal key generation now produces proper "p:g:h" format with colons
- Removed all double base64-encoding issues
- Simplified API responses to decode bytes to UTF-8 strings for JSON serialization

FRONTEND CHANGES:
- Refactored ElGamalEncryption.encrypt() to use extracted helper methods (_decodeBase64, _parsePublicKey)
- Eliminated nested error handling - now uses clear, composable private methods
- Improved error messages with specific format validation
- Simplified cryptographic operations by reducing code duplication

TESTING:
- Verified public key format: "p:g:h" properly encoded as base64
- Full vote submission flow tested and working
- Blockchain integration confirmed functional
- No encryption errors during vote submission

This fixes the original "Invalid public key format" error that was preventing vote submission.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-07 18:56:58 +01:00
..

E-Voting System - Post-Quantum Cryptography

Système de vote électronique sécurisé avec cryptographie post-quantique hybride certifiée NIST FIPS 203/204.

🚀 Démarrer

# Lancer tous les services
docker-compose up -d

# Frontend: http://localhost:3000
# API: http://localhost:8000/docs
# Database: localhost:3306

🔐 Sécurité Post-Quantique

  • Signatures: RSA-PSS + ML-DSA-65 (Dilithium) - FIPS 204
  • Chiffrement: ML-KEM-768 (Kyber) + ElGamal - FIPS 203
  • Hachage: SHA-256 (quantum-resistant)
  • Approche hybride: Defense-in-depth

Voir .claude/POSTQUANTUM_CRYPTO.md pour les détails.

📁 Structure

.
├── docker/                 # Configuration Docker
├── src/
│   ├── backend/           # API FastAPI
│   ├── crypto/            # Cryptographie classique + PQC
│   └── frontend/          # Interface web
├── tests/                 # Tests unitaires
├── docker-compose.yml
└── README.md

🧪 Tests

pytest tests/ -v

🔑 Clés Cryptographiques

  • Génération: Clés hybrides RSA + Dilithium + Kyber à l'inscription
  • Stockage: Base de données sécurisée
  • Signatures: RSA-PSS + Dilithium sur chaque vote
  • Chiffrement: ML-KEM-768 (Kyber)

📊 Endpoints API

  • POST /api/auth/register - Inscription avec génération de clés PQC
  • POST /api/auth/login - Authentification JWT
  • GET /api/elections/active - Élection active
  • POST /api/votes/submit - Vote signé avec signatures hybrides
  • GET /api/elections/{id}/results - Résultats

Voir http://localhost:8000/docs pour API interactive.


Production-ready post-quantum e-voting system 🔐 MIT