votingSystem
Class KeyGenerator

java.lang.Object
  extended byvotingSystem.KeyGenerator

public class KeyGenerator
extends java.lang.Object

This class will be used to generate the keys for the decryption servers, as well as the public key for the election.

Author:
Bent

Constructor Summary
KeyGenerator(java.util.Random r, int bitlength, int s)
          This constructor will make a new KeyGenerator with the Random-generator r
 
Method Summary
 KeyShare[] generateKeys(int l, int w)
          Generates the KeyShares for the decryption servers
 java.math.BigInteger[] generateSafePrime(int bitlength)
          Generates a safe prime (p = 2p' + 1) where p' is a prime with 1-2^100 probability
 java.math.BigInteger getD()
           
 java.math.BigInteger getG()
           
 java.math.BigInteger getM()
           
 java.math.BigInteger getN()
           
 java.math.BigInteger getP()
           
 PublicKey getPk()
           
 java.math.BigInteger getQ()
           
 java.util.Random getR()
           
 int getS()
           
 java.math.BigInteger getV()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyGenerator

public KeyGenerator(java.util.Random r,
                    int bitlength,
                    int s)
This constructor will make a new KeyGenerator with the Random-generator r

Parameters:
r - A Random generator
bitlength - The bitlength of the key
s - The exponent used in the cryptosystem.
Method Detail

generateKeys

public KeyShare[] generateKeys(int l,
                               int w)
Generates the KeyShares for the decryption servers

Parameters:
l - Number of decryption servers
w - Number of decryption servers needed to perform decryption
Returns:
The array of KeyShares for all servers.

generateSafePrime

public java.math.BigInteger[] generateSafePrime(int bitlength)
Generates a safe prime (p = 2p' + 1) where p' is a prime with 1-2^100 probability

Parameters:
bitlength - The bitlength of the primes to be generated
Returns:
The numbers p and p'

getD

public java.math.BigInteger getD()

getM

public java.math.BigInteger getM()

getN

public java.math.BigInteger getN()

getR

public java.util.Random getR()

getS

public int getS()

getV

public java.math.BigInteger getV()

getG

public java.math.BigInteger getG()

getP

public java.math.BigInteger getP()

getQ

public java.math.BigInteger getQ()

getPk

public PublicKey getPk()