votingSystem
Class Encryption

java.lang.Object
  extended byvotingSystem.Encryption

public class Encryption
extends java.lang.Object

This class handles the encryption process in the generalized Paillier cryptosystem used in the voting system. This class is not used in the Voting system, as the Voter class contains and optimized variant of the encryption algorithm.

Author:
Bent K. Onshus

Constructor Summary
Encryption(int k, int noOfVoters, int s, java.math.BigInteger n, java.math.BigInteger g)
          Constructs the Encryption object
 
Method Summary
 java.math.BigInteger encryptGenPailler(java.math.BigInteger r, java.math.BigInteger i_, int s)
          Encrypts a vote i_ with random number r
 java.math.BigInteger encryptGenPaillerSimple(java.math.BigInteger r, java.math.BigInteger i_, int s)
           
 java.math.BigInteger encryptSmall(java.math.BigInteger[] a, java.math.BigInteger r)
           
 java.math.BigInteger[] preCompGenPailler()
           
 void testEncryption()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Encryption

public Encryption(int k,
                  int noOfVoters,
                  int s,
                  java.math.BigInteger n,
                  java.math.BigInteger g)
Constructs the Encryption object

Parameters:
k - Security parameter (bitlength)
noOfVoters - Number of voters
s - The s in n^s
n - p*q
g - A generator of the group n^s
Method Detail

testEncryption

public void testEncryption()

preCompGenPailler

public java.math.BigInteger[] preCompGenPailler()

encryptGenPailler

public java.math.BigInteger encryptGenPailler(java.math.BigInteger r,
                                              java.math.BigInteger i_,
                                              int s)
Encrypts a vote i_ with random number r

Parameters:
r - Random number
i_ - The vote
s - The s in n^s
Returns:
the ciphertext

encryptGenPaillerSimple

public java.math.BigInteger encryptGenPaillerSimple(java.math.BigInteger r,
                                                    java.math.BigInteger i_,
                                                    int s)

encryptSmall

public java.math.BigInteger encryptSmall(java.math.BigInteger[] a,
                                         java.math.BigInteger r)