|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--demo.Client
The client class is a thread that sports a JFrame
window. The purpose of the thread is to act like an independent client, without actually being a truly independent client. The "dealer" remains in control of each client, but only communicates with each client by creating the same kinds of messages that would be used by networked clients.
The only JFrame
component is the ClientDisplay
class, an extension of JPanel
. All GUI changes are made via the ClientDisplay
class. There is also a hook for the one button, "corrupt", in the display to the share.corrupt()
method.
Field Summary |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
Client(int numBits,
int shareNumber,
java.security.PrivateKey privateKey,
java.security.PublicKey[] publicKeys)
Creates a new instance of Client |
Method Summary | |
protected void |
corruptShare()
Instructs the client to corrupt its share. |
protected byte[] |
genMessage(java.util.LinkedList data)
Takes the data for the message as a LinkedList and turns it into a byte array along with a digital signature for the data bytes. |
protected byte[] |
genRecoverSecretMessage(int recovererShareNumber)
This method is used by clients to generate a message for the recoverer. |
protected java.lang.String |
getCommitment()
Gets the commitment value as a string for display on the client window. |
protected RSACryptoManager |
getCryptoManager()
Returns a reference to the client's RSACryptoManager . |
protected java.lang.String |
getOriginalCommitment()
Gets the original commitment value as a string for display on the client window. |
protected java.lang.String |
getOriginalSecret()
Gets the original secret as a string for display on the client window. |
protected int |
getRound()
The current round number. |
protected java.lang.String |
getSecret()
Gets the secret as a string for display on the client window. |
int |
getShareNumber()
Returns the share number of the current client. |
protected void |
incrementRound()
Increments the current round number for this share. |
protected java.util.LinkedList |
processMessage(byte[] message,
int senderShareNumber)
Performs the opposite operation as genMessage() . |
protected void |
receiveShare(byte[] input,
int senderShareNumber)
This method is used by the dealer to initially give the client its share. |
protected java.math.BigInteger |
recoverSecret(byte[][] messages)
The method called by the recoverer to recover the secret from the data contained in the array of messages. |
protected void |
recoverShare(byte[][] messages)
The second of two methods used by invalid clients in share recovery. |
protected byte[] |
recoverShareFinal(byte[][] messages)
The second of two methods used by valid shares in share recovery. |
protected byte[][] |
recoverShareInit(int recoverShareNumber)
Performs the first of two steps for share recovery for valid shares. |
protected void |
recoverShareListen(byte[][] messages)
The first of two methods used by invalid clients in share recovery. |
protected void |
renewalFinal(byte[][] messages)
The second of two methods used for share renewal. |
protected byte[][] |
renewalInit()
The first of two functions involved in share renewal. |
void |
run()
Overrides the run method of class Thread. |
protected boolean |
validate()
Validate the client's share. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Client(int numBits, int shareNumber, java.security.PrivateKey privateKey, java.security.PublicKey[] publicKeys)
numBits
- The minimum number of bits in the BigInteger
.shareNumber
- The share number of the current client.privateKey
- The RSA private key for the current client.publicKeys
- The array of RSA public keys for all of the clients.Method Detail |
protected RSACryptoManager getCryptoManager()
Returns a reference to the client's RSACryptoManager
.
RSACryptoManager
for the current client.public int getShareNumber()
Returns the share number of the current client. As it is public information, this is available outside of the package.
int
.protected int getRound()
The current round number. This is needed by the dealer and a few other methods. The round number is maintained by the client and is not part of the secret share.
int
.protected void incrementRound()
Increments the current round number for this share.
public void run()
Overrides the run method of class Thread. It starts up the GUI component of the client.
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected void receiveShare(byte[] input, int senderShareNumber) throws ClientException
This method is used by the dealer to initially give the client its share. The share is in a "message" for and includes a signature.
The first task of the client is to verify the signature and then decrypt the secret share and commitment values.
Provided all goes well with the verification and the decryption, the share is added to the client.
input
- A byte
encoded version of the message from the dealer.senderShareNumber
- The share number of the dealer.
ClientException
- Indication of an error processing the message.protected void corruptShare() throws ClientException
Instructs the client to corrupt its share.
ClientException
- Indication of an error corrupting the client.protected java.lang.String getSecret()
Gets the secret as a string for display on the client window.
protected java.lang.String getCommitment()
Gets the commitment value as a string for display on the client window.
protected java.lang.String getOriginalSecret()
Gets the original secret as a string for display on the client window.
protected java.lang.String getOriginalCommitment()
Gets the original commitment value as a string for display on the client window.
protected byte[] genMessage(java.util.LinkedList data) throws ClientException
Takes the data for the message as a LinkedList
and turns it into a byte
array along with a digital signature for the data bytes.
data
- A LinkedList
containing all of the data for the message.
byte
array with the serialized data and a digital signature.
ClientException
- Indication of an error creating the message.protected java.util.LinkedList processMessage(byte[] message, int senderShareNumber) throws ClientException
Performs the opposite operation as genMessage()
. It takes the byte
array and the share number of the sender and verifies the digital signature and then returns the data as a LinkedList
.
message
- The serialized message created by genMessage()
senderShareNumber
- The share number of the sender. Used to identify the proper public key to use.
LinkedList
with the data from the message.
ClientException
- Indication of an error processing the message.protected boolean validate()
Validate the client's share.
protected byte[][] recoverShareInit(int recoverShareNumber) throws ClientException
Performs the first of two steps for share recovery for valid shares.
This method creates a message that contains the subshares such that f(r) = g(r) = 0.
recoverShareNumber
- The share number of client that you are trying to recover.
ClientException
- Indication of an error creating the message.protected byte[] recoverShareFinal(byte[][] messages) throws ClientException
The second of two methods used by valid shares in share recovery. It creates shares of the bad share.
The function creates a message for the invalid share that contains the share of the invalid share.
messages
- The messages from the other valid servers.
ClientException
- An indication of an error creating the message for the invalid client.protected void recoverShareListen(byte[][] messages) throws ClientException
The first of two methods used by invalid clients in share recovery.
This method looks at all of the messages from the valid clients and uses the commitment arrays to create public versions for the shares that it will receive later.
messages
- The messages from the valid clients.
ClientException
- An indication of an error gathering the commitment array values.protected void recoverShare(byte[][] messages) throws ClientException
The second of two methods used by invalid clients in share recovery.
This method is used by the particular invalid client to recover its share from the shares given to it by the valid clients. It verifies those shares using the information that it collected in recoverShareListen()
.
messages
- The messages from the valid clients containing the shares of this client's share.
ClientException
- An indication of an error recovering the share.protected byte[] genRecoverSecretMessage(int recovererShareNumber) throws ClientException
This method is used by clients to generate a message for the recoverer. The message contains the secret share and commitment value held by this client.
recovererShareNumber
- The share number of the recoverer.
ClientException
- An indication of an error creating the message.protected java.math.BigInteger recoverSecret(byte[][] messages) throws ClientException
The method called by the recoverer to recover the secret from the data contained in the array of messages.
messages
- An array of messages from all clients containing their secret share and commitment value.
BigInteger
.
ClientException
- An indication of an error recovering the secret.protected byte[][] renewalInit() throws ClientException
The first of two functions involved in share renewal. It creates a share of zero and then a message to each client with that client's share of zero.
ClientException
- An indication of an error creating the array of messages.protected void renewalFinal(byte[][] messages) throws ClientException
The second of two methods used for share renewal. It takes all messages from the other clients and adds each share of zero to its own share.
messages
- An array of digitally signed messages from the other shares for this client.
ClientException
- An indication of an error renewing the local share.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |