This codebase is a proof of concept (PoC) of an e-voting system using Paillier homomorphic encryption.
The project was written using Python 3.5.2. To install dependencies (PyCrypto, etc), change to root project directory (the one containing requirements.txt) and run:
pip install -r requirements.txt
Note: You can modify the number of candidates and number of voters in config.py
-
Run cleanup script (to clean stale state files)
python cleanup.py
-
Run Election Board (EM), Bulletin Board (BB) and Voter in that order.
# in Terminal 1 (Election Board - EM) python em.py
# in Terminal 2 (Bulletin Board - BB) python bb.py
# in Terminal 3 (Voter) python voter.py
-
Voting will stop automatically when all voters have cast their vote. It can also be manually stopped by running
close_voting.py
python close_voting.py
Voter IDs are of the pattern Voter00
, Voter01
, Voter02
, etc. Voter's PIN is the same as his ID i.e. PIN for Voter00
is Voter00
and so on.
- Keys are shared between Election Board (EM) and Bulletin Board (BB) in advance. Key sharing is secure and trusted.
- Bulletin Board (BB) and Election Board (EM) systems are secure (i.e. adversary cannot control them and/or obtain keys).
- Connection between Bulletin Board (BB) and Election Board (EM) is secure and trusted (e.g. communication happens over TLS/SSL and both servers know each others identity).
- Election Board (EM) is, in reality, a group of individuals/institutions who possess secret key in t-n threshold sharing fashion. They decrypt their share of the final encrypted tally (they never physically come together) .
- Any vulnerability in PyCrypto is out of scope
- Muhammad Ishaq (ishaq@ishaq.pk)
- Daniel Park (parkd5@rpi.edu)
- PyCrypto is used for RSA encryption and SHA-256 hashes. PyCrypto is a dead project. We shall, if time permitted, shift to cryptography.
- Paillier is used for Paillier homomorphic encryption. We modified it a considerably to fix bugs and make it work with Python 3.