[View Live Demo] • [Report Bug] • [Request Feature]
- Public Access: https://sistema-de-votacion-de-criptografia.onrender.com
⚠️ Deployment Note: The server may take 30 to 50 seconds to wake up and load the first time due to free tier energy-saving policies.
The system is built on a Hybrid Cryptographic Scheme that ensures the integrity and confidentiality of the voting process:
- Each voter generates a 2048-bit RSA key pair.
- The Public Key is stored on the server for signature validation.
- The Private Key is downloaded to the user's device (
.keyfile) and is strictly required to vote.
- Digital Signature: A SHA-256 hash of the vote is generated and signed with the user's Private Key, ensuring Non-Repudiation and Integrity.
- Hybrid Encryption: The vote payload is encrypted using AES-256 CBC before transmission, guaranteeing Confidentiality.
- Real-Time Results: Live dashboard with graphical visualization of the election.
- Audit Module: Admin interface to inspect and validate digital signatures and hashes.
- Key Validation: Tool for voters to verify the status and validity of their key pairs.
| Component | Technology / Library | Version | Description |
|---|---|---|---|
| Backend | Django | 5.2.8 | Main web framework. |
| Cryptography | PyCryptodome | 3.23.0 | Implementation of RSA, AES, and SHA256. |
| Config | Python-Decouple | 3.8 | Environment variable management. |
| Database | DJ-Database-URL | 3.0.1 | Database agnostic connection (SQLite / PostgreSQL). |
| Static Files | WhiteNoise | 6.11.0 | Static file serving for production. |
| WSGI Server | Gunicorn | 23.0.0 | WSGI HTTP Server for UNIX. |
Follow these exact steps to get the project running locally using Visual Studio Code (VS Code).
Ensure you have the following installed:
- Python 3.10+: Download Here (Check "Add Python to PATH").
- VS Code: Download Here.
- Python Extension: Install
Python (Microsoft)from the VS Code Marketplace. - Git: (Optional) Download Here.
-
Clone the Repository
git clone [YOUR_REPO_URL] cd sistema-de-votacion-electronica -
Create & Activate Virtual Environment
Django should be installed inside a virtual environment to isolate dependencies.
# Create environment python -m venv venv # Activate environment # Windows: .\venv\Scripts\activate # Mac/Linux: source venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
-
Apply Migrations
python manage.py migrate
-
Create Admin User
python manage.py createsuperuser
-
Run Local Server
python manage.py runserver
- Open browser at: 👉 http://127.0.0.1:8000/
pip install -r requirements.txt && python manage.py collectstatic --noinput && python manage.py migrate
gunicorn voting_project.wsgi:application
⚠️ Warning: These commands will delete all users (except superusers) and votes. Backup data if necessary!
- Open Django Shell:
python manage.py shell
- Run Cleanup Scripts:
# A) Import models
from django.contrib.auth.models import User
from voting.models import Vote, VoterProfile
# B) Delete non-superuser accounts
User.objects.filter(is_superuser=False).delete()
# C) Clear all votes and reset voting status
Vote.objects.all().delete()
VoterProfile.objects.update(has_voted=False)
# D) Exit shell
exit()This project was developed for the Cryptography course at the National Autonomous University of Mexico (UNAM).
| Course Information | Details |
|---|---|
| University | Universidad Nacional Autónoma de México (UNAM) |
| Faculty | Faculty of Engineering |
| Course | Cryptography |
| Professor | Dr. Alfonso Francisco De Abiega L Eglisse |
| Group | 02 |
- Lee Obando Ileana Verónica
- Rojas Mares Luis Iván
Distributed under the MIT License.