Skip to content

Secure electronic voting platform implementing RSA/AES encryption and SHA-256 digital signatures. Final Project for the Cryptography course, FI UNAM.

Notifications You must be signed in to change notification settings

LilianaVo/Secure-CryptoVoting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗳️ Secure Electronic Voting System (CryptoVoting)

A robust web platform implementing advanced cryptographic standards for secure digital elections.

Django Python Security Deploy

[View Live Demo] • [Report Bug] • [Request Feature]


🔗 Live Demo


Key Features

The system is built on a Hybrid Cryptographic Scheme that ensures the integrity and confidentiality of the voting process:

1. 🔑 Public Key Infrastructure (PKI)

  • 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 (.key file) and is strictly required to vote.

2. 🛡️ Vote Security

  • 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.

3. 📈 Transparency & Auditing

  • 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.

🛠️ Tech Stack

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.

🚀 Local Installation & Execution Guide

Follow these exact steps to get the project running locally using Visual Studio Code (VS Code).

⚙️ Prerequisites

Ensure you have the following installed:

  1. Python 3.10+: Download Here (Check "Add Python to PATH").
  2. VS Code: Download Here.
  3. Python Extension: Install Python (Microsoft) from the VS Code Marketplace.
  4. Git: (Optional) Download Here.

Execution Steps

  1. Clone the Repository

    git clone [YOUR_REPO_URL]
    cd sistema-de-votacion-electronica
  2. 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
  3. Install Dependencies

    pip install -r requirements.txt
  4. Apply Migrations

    python manage.py migrate
  5. Create Admin User

    python manage.py createsuperuser
  6. Run Local Server

    python manage.py runserver

☁️ Production Deployment (Render)

Build Command

pip install -r requirements.txt && python manage.py collectstatic --noinput && python manage.py migrate

Start Command

gunicorn voting_project.wsgi:application

🔄 Maintenance: Quick System Reset

⚠️ Warning: These commands will delete all users (except superusers) and votes. Backup data if necessary!

  1. Open Django Shell:
python manage.py shell
  1. 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()

Academic Context

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

Contributors

  • Lee Obando Ileana Verónica
  • Rojas Mares Luis Iván

📄 License

Distributed under the MIT License.

About

Secure electronic voting platform implementing RSA/AES encryption and SHA-256 digital signatures. Final Project for the Cryptography course, FI UNAM.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published