demo
Class Dealer

java.lang.Object
  |
  +--demo.Dealer

public class Dealer
extends java.lang.Object

The dealer class runs the sharing operations loosely as the first client.

Version:
.4
Author:
Brice Daniels

Constructor Summary
Dealer()
          Creates a new instance of Dealer
 
Method Summary
protected  java.math.BigInteger[] generateValues(int numBits)
          Calls ShareUtil.generateValues().
protected  java.lang.String getRound()
          The current round number.
protected  java.lang.String getSecret()
          Get the secret as a string.
protected  void init(int n, int k, java.math.BigInteger secret, java.math.BigInteger p, java.math.BigInteger q, java.math.BigInteger g, java.math.BigInteger h, int numBits)
          Initializes the dealer and starts the secret sharing.
protected  java.math.BigInteger recoverSecret()
          Takes the appropriate steps to recover the secret.
protected  java.lang.String recoverShares()
          Attempts to recover shares found to be bad by validateShares().
protected  void renewShares()
          Attempts to renew the shares of all of the clients.
protected  int validateShares()
          Used to validate the clients.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dealer

public Dealer()
Creates a new instance of Dealer

Method Detail

init

protected void init(int n,
                    int k,
                    java.math.BigInteger secret,
                    java.math.BigInteger p,
                    java.math.BigInteger q,
                    java.math.BigInteger g,
                    java.math.BigInteger h,
                    int numBits)
             throws DealerException

Initializes the dealer and starts the secret sharing.

Parameters:
n - The number of clients.
k - The threshold number.
secret - The secret to share.
p - The prime modulus p.
q - The prime modulus q.
g - The prime modulus g.
h - The prime modulus h.
numBits - The number of bits for all randomly generated values.
Throws:
DealerException - An indication of error during initialization.

getSecret

protected java.lang.String getSecret()

Get the secret as a string.

Returns:
The secret as a string.

getRound

protected java.lang.String getRound()

The current round number.

Returns:
The current round number as a string.

generateValues

protected java.math.BigInteger[] generateValues(int numBits)

Calls ShareUtil.generateValues().

Parameters:
numBits - The number of bits to use in the random values.
Returns:
The four public values as a BigInteger array.

recoverShares

protected java.lang.String recoverShares()
                                  throws DealerException

Attempts to recover shares found to be bad by validateShares().

Returns:
A string stating which clients were recovered. It is null if no clients were recovered.
Throws:
DealerException - An indication of an error during recovery.

validateShares

protected int validateShares()

Used to validate the clients. It creates a list of bad shares for recoverShares().

Returns:
The number of invalid clients.

recoverSecret

protected java.math.BigInteger recoverSecret()
                                      throws DealerException

Takes the appropriate steps to recover the secret.

Returns:
The secret as a BigInteger.
Throws:
DealerException - An indication of error during the attempt to recover the secret.

renewShares

protected void renewShares()
                    throws DealerException

Attempts to renew the shares of all of the clients.

Throws:
DealerException - An indication of an error while renewing shares.