Skip to content

rsjuru/Anamorphic-MultiUser-Scheme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Multi-user Application for Electronic Voting Scheme

This repository contains a simple implementation of an electronic voting scheme where users cast their votes anamorphically. In this scheme, each user casts two votes:

  • Regular vote: A fake vote to fool vote buyers.
  • Anamorphic vote: The real vote that counts.

The regular vote allows users to confirm for vote buyers that they voted for the fake candidate, as the system can reveal votes by user ID.


Notes

  • Current functionalities are limited: user registration, vote casting, and checking the vote by ID.
  • This is a demo/toy implementation of anamorphic encryption in electronic voting and does not provide full security features.
  • Strong user authentication is skipped.
  • It is assumed that users register and cast their vote in one session.

Requirements

  • Go programming language (version 1.20+ recommended)

Verify your Go installation:

  • Go programming language (version 1.20+ recommended)

You can verify your Go installation with:

go version

Running the Program

Start the server:

go run ./server

This server runs by default on localhost:8080. You can change this in the main.go file.

There are two ways to use the program: Command Line or Browser.

1. Command line

Open a new terminal. Three functionalities are available:

Register User

$userID = "user123"

$response = Invoke-RestMethod -Uri "http://localhost:8080/registerUser" `
                            -Method Post `
                            -Body @{ userID = $userID }

Write-Output "User registration response: $response"

Confirmation or error message appear in the terminal.

Cast Vote

$userID = "user123"
$regularVote = 0
$anamorphicVote = 1

$response = Invoke-RestMethod -Uri "http://localhost:8080/castVote" `
                            -Method Post `
                            -Body @{
                                userID = $userID
                                regular = $regularVote
                                anamorphic = $anamorphicVote
                            }

Write-Output "Vote response: $response"

Confirmation or error message appear in the terminal.

Check Vote (for Vote Buyer)

Invoke-RestMethod -Uri "http://localhost:8080/revealVote?userID=user123" -Method GET -UseBasicParsing

The terminal displays the regular vote or an error message.

Browser

Open a browser and navigate to http://localhost:8080. The interface allows:

User Registration

  • Enter a userID and click Register/Authenticate
  • On success, you are redirected to the vote casting page.
  • Errors (e.g., User already exists) are displayed on the front page.

Vote Casting

  • Enter your regular and anamorphic votes.
  • Click Submit Vote.
  • On success, you return to the front page. Errors are displayed if any.

Checking Vote (for Vote Buyer)

  • Enter a userID to check the regular vote.
  • Errors are displayed on the page if the vote cannot be retrieved.

Note: The application stores the state (Authority and Vote Collector) and user information in .json files. You can reset or clear these files by uncommenting the ClearUserStore() and ClearState() calls in the main function.

About

Multi-User demo application for electornic voting preventing vote buying

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages