voter
Class Voter

java.lang.Object
  extended byvoter.Voter

public class Voter
extends java.lang.Object

The class for the Client side of the election.

Author:
bent

Constructor Summary
Voter(int id, ElectionProperties ep, PublicKey pk, java.util.Random rand, BulletinBoard bb)
          Creates a new Voter for the election
 
Method Summary
 java.math.BigInteger[] encrypt(int candidate)
          Unoptimized encryption algorithm
 MultipleBinaryVotes encryptMultipleVoteBinary(int[] candidate)
          Encrypts the chosen votes using the method explained as k-out-of-L Binary encoded voting.
 MultipleVotes encryptMultipleVotes(int[] candidate)
          Encrypts the chosen votes using the method explained as k-out-of-L voting.
 java.math.BigInteger[] encryptOptimized(java.math.BigInteger value)
          Optimized encryption algorithm for encrypting a BigInteger.
 java.math.BigInteger[] encryptOptimized(int candidate)
          The optimized encryption algorithm
 Vote encryptVote(int candidate)
          The method for encrypting a Vote and creating the proof of correctness in the case of 1-out-of-L elections
 BinaryVote encryptVoteBinary(int candidate)
          Encrypts a vote in the case of 1-out-of-L Binary Voting
 void postKofLVote(int[] candidate)
          Method for posting a vote to the bulletin board
 void postKofLVoteBinary(int[] candidate)
          Method for posting a vote to the bulletin board
 void postOneofLVote(int candidate)
          Method for posting a vote to the bulletin board
 void postOneofLVoteBinary(int candidate)
          Method for posting a vote to the bulletin board
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Voter

public Voter(int id,
             ElectionProperties ep,
             PublicKey pk,
             java.util.Random rand,
             BulletinBoard bb)
Creates a new Voter for the election

Parameters:
id - The Voter id
ep - The ElectionProperties for the election
pk - The PublicKey for the election
rand - The random-number generator
Throws:
IncorrectParameterException
Method Detail

postOneofLVote

public void postOneofLVote(int candidate)
                    throws java.rmi.RemoteException,
                           IncorrectVoteException
Method for posting a vote to the bulletin board

Parameters:
candidate -
Throws:
java.rmi.RemoteException
IncorrectVoteException

postKofLVote

public void postKofLVote(int[] candidate)
                  throws java.rmi.RemoteException,
                         IncorrectVoteException
Method for posting a vote to the bulletin board

Parameters:
candidate - Chosen candidates
Throws:
java.rmi.RemoteException
IncorrectVoteException

postOneofLVoteBinary

public void postOneofLVoteBinary(int candidate)
                          throws java.rmi.RemoteException,
                                 IncorrectVoteException
Method for posting a vote to the bulletin board

Parameters:
candidate - Chosen candidate
Throws:
java.rmi.RemoteException
IncorrectVoteException

postKofLVoteBinary

public void postKofLVoteBinary(int[] candidate)
                        throws java.rmi.RemoteException,
                               IncorrectVoteException
Method for posting a vote to the bulletin board

Parameters:
candidate - Chosen candidates
Throws:
java.rmi.RemoteException
IncorrectVoteException

encryptVote

public Vote encryptVote(int candidate)
                 throws IncorrectVoteException
The method for encrypting a Vote and creating the proof of correctness in the case of 1-out-of-L elections

Parameters:
candidate - The candidate the Client voted for
Returns:
The Vote including the proof of correctness
Throws:
IncorrectVoteException

encrypt

public java.math.BigInteger[] encrypt(int candidate)
Unoptimized encryption algorithm

Parameters:
candidate -
Returns:
The vote and the random value used in the computations

encryptOptimized

public java.math.BigInteger[] encryptOptimized(int candidate)
The optimized encryption algorithm

Parameters:
candidate -
Returns:
The ciphertext and the random value used to hide the plaintext

encryptOptimized

public java.math.BigInteger[] encryptOptimized(java.math.BigInteger value)
Optimized encryption algorithm for encrypting a BigInteger. Mainly used when making the zero-knowledge proofs.

Parameters:
value -
Returns:
The ciphertext and the random value used to hide the plaintext

encryptMultipleVotes

public MultipleVotes encryptMultipleVotes(int[] candidate)
                                   throws IncorrectVoteException
Encrypts the chosen votes using the method explained as k-out-of-L voting.

Parameters:
candidate - chosen candidates
Returns:
The MultipleVotes object containing the votes and proofs needed.
Throws:
IncorrectVoteException - If any choices were out of bounds, or if incorrect number of votes were cast.

encryptMultipleVoteBinary

public MultipleBinaryVotes encryptMultipleVoteBinary(int[] candidate)
                                              throws IncorrectVoteException
Encrypts the chosen votes using the method explained as k-out-of-L Binary encoded voting.

Parameters:
candidate - chosen candidates
Returns:
The MultipleBinaryVotes object containing the votes and proofs needed.
Throws:
IncorrectVoteException - If any choices were out of bounds, or if incorrect number of votes were cast.

encryptVoteBinary

public BinaryVote encryptVoteBinary(int candidate)
                             throws IncorrectVoteException
Encrypts a vote in the case of 1-out-of-L Binary Voting

Parameters:
candidate - The candidate that was voted for
Returns:
The BinaryVote holding the ciphertext and the needed zero-knowledge proofs of correctness
Throws:
IncorrectVoteException - If the choice was out of bounds