com.SecurePlay.SPTSecret
Class SPTSecretClass

java.lang.Object
  extended bycom.SecurePlay.SPRootTransactionClass
      extended bycom.SecurePlay.SPAbstractTransactionClass
          extended bycom.SecurePlay.SPTSecret.SPTSecretClass
All Implemented Interfaces:
SPAbstractTransactionInterface

public class SPTSecretClass
extends SPAbstractTransactionClass

This class implements the Secret Transaction type - the ability for a single party, the Transaction Master, to send a single secret to other participants in a non-refutable fashion. The Secret is committed to irrevokably at the time it is initially sent in hidden form and then can be subsequently revealed.

Author:
IT GlobalSecure
See Also:
SecurePlay License Information
 

Field Summary
 
Fields inherited from class com.SecurePlay.SPAbstractTransactionClass
classAPI, configuration, gameblock, gameinstance, transactionstatus, transtype
 
Fields inherited from class com.SecurePlay.SPRootTransactionClass
EventListenerList, gameID, master, playerIDList, transactionID
 
Constructor Summary
SPTSecretClass(SPGameInterface gameobj, java.lang.String master, java.lang.String[] playerIDList, boolean privateflag, java.lang.String transactionID)
          Overloaded Constructor
 
Method Summary
static boolean APIBcreateTransaction(SPGameAPIClass gapi, java.lang.String transmaster, java.lang.String[] playerIDList, boolean privateflag)
          This method allows the creation of a new Secret type, internally controlled transaction.
static SPTSecretClass APIcreateTransaction(SPGameAPIClass gapi, java.lang.String transmaster, java.lang.String[] playerIDList, boolean privateflag)
          This method allows the creation of a new Secret type, internally controlled transaction.
 java.lang.String APIgetSecret()
          This method returns the actual secret that this transaction is protecting, if available.
 boolean APIrequestrevealSecret(java.lang.String pid, java.lang.String[] receivers, java.lang.String liststatus)
          This method allows a third party player to request that the secret be revealed by the transaction master to the specified receiver list.
 boolean APIrequestsendHiddenSecret(java.lang.String pid, java.lang.String newsecret)
          This method allows a non-transaction master to request the transaction master send a Secret.
 boolean APIrevealSecret(java.lang.String sender, java.lang.String[] recievers, java.lang.String liststatus)
          This method sends the secretpadded value to the specified remote players.
 boolean APIsendHiddenSecret(java.lang.String sender, java.lang.String newsecret)
          This method allows the Secret Transaction master to send the transform of a secret to the other participants in the transaction.
static SPTSecretAPIClass APITAOcreateTransaction(SPGameAPIClass gapi, java.lang.String transmaster, java.lang.String[] playerIDList, boolean privateflag)
          This method allows the creation of a new Secret type, internally controlled transaction.
 boolean APIverifySecret()
          This method verifies the paddedsecret that was sent.
protected  SPAbstractTransactionInterface buildSPawn()
          This method provides the unique transaction creation services for spawned Secret transactions
 SPAbstractTransactionInterface createTransaction(SPGameAPIInterface gameapiobj, java.lang.String master, java.lang.String[] playerIDList, boolean privateflag, java.lang.String transactionID)
          This method creates a SPSecretClass transaction.
 int getPrpadlength()
          Getter function that returns the property: prpadlength
 java.lang.String getSecretpadded()
          Getter function that returns the property: secretpadded
 java.lang.String getSecrettransform()
          Getter function that returns the property: secrettransform
static java.lang.String gettranstype()
          This method gets the transaction type.
 void onrequestrevealSecret(SPMessageClass incoming)
          This method handles incoming requests for the transaction master to create a revealSecret message to the specified receivers.
 void onrequestsendHiddenSecret(SPMessageClass incoming)
          Handles incoming requests to create a sendHiddenSecret message
 boolean onrevealSecret(SPMessageClass incoming)
          This method handles the incoming message to reveal a secret.
 boolean onsendHiddenSecret(SPMessageClass incoming)
          This method handles incoming sendHiddenSecret messages.
 boolean pronincomingTransaction(SPMessageClass incoming)
          This method provides the unique handlers for incoming Secret turn message types
static boolean registerTransaction()
          Registers this transaction.
protected  boolean spawnConfigure(SPAbstractTransactionInterface a)
          This method provides the unique transaction configuration services for spawned Secret transactions
 SPTSecretAPIClass SPgetAPI()
          Gets this class's API
 
Methods inherited from class com.SecurePlay.SPAbstractTransactionClass
APIbeginTransaction, APIcompleteTransaction, APIconfigureTransaction, APIgetGameBlock, APIrequestbeginTransaction, APIrequestCompleteTransaction, APIrequestconfigureTransaction, APIsetGameBlock, APISPawn, getClassAPI, getConfiguration, getGameinstance, getLasterror, getPrivacyFlag, getTransactionstatus, getTransactionType, isPlayerInternal, isPrivateflag, logError, onbeginTransaction, onconfigureTransaction, onconfigureTransaction, onincomingTransaction, onrequestbeginTransaction, onrequestcompleteTransaction, onrequestconfigureTransaction, onSpawn, pruniqueinit, sendMessage, setGameBlock, setTransactionID, transComplete, transError
 
Methods inherited from class com.SecurePlay.SPRootTransactionClass
APIAddListener, APIClearListeners, APIGetListenerCount, APIGetListeners, APIRemoveListener, getGameID, getMaster, getPlayerIDList, getTransactionID, isPlayerIncluded, SPnotify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.SecurePlay.SPAbstractTransactionInterface
getGameID, getMaster, getPlayerIDList, getTransactionID
 

Constructor Detail

SPTSecretClass

public SPTSecretClass(SPGameInterface gameobj,
                      java.lang.String master,
                      java.lang.String[] playerIDList,
                      boolean privateflag,
                      java.lang.String transactionID)
Overloaded Constructor

Parameters:
gameobj - SPGameInterface - the game object to which this transaction will be associated with
master - String - the master of this transaction
playerIDList - String[] - players who will be associated with this transaction
privateflag - boolean - private flag of this transaction
transactionID - String - the id of this transaction
Method Detail

APIsendHiddenSecret

public boolean APIsendHiddenSecret(java.lang.String sender,
                                   java.lang.String newsecret)
This method allows the Secret Transaction master to send the transform of a secret to the other participants in the transaction.

Parameters:
sender - String - the sender of the hidden secret
newsecret - String - the secret message
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

APIrevealSecret

public boolean APIrevealSecret(java.lang.String sender,
                               java.lang.String[] recievers,
                               java.lang.String liststatus)
This method sends the secretpadded value to the specified remote players.

Parameters:
sender - String - the sender of the secret
recievers - String[] - player ids of recievers
liststatus - String - "P" or "L"
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

APIverifySecret

public boolean APIverifySecret()
This method verifies the paddedsecret that was sent. It computes the transform of the paddedsecret that has been sent and compares it with the previously sent secrettransform. It returns a Boolean flag to indicate success or failure.

Returns:
result - Boolean: TRUE, if able to verify secret, FALSE, if not

APIgetSecret

public java.lang.String APIgetSecret()
This method returns the actual secret that this transaction is protecting, if available.

Returns:
result - String - the secret

onsendHiddenSecret

public boolean onsendHiddenSecret(SPMessageClass incoming)
This method handles incoming sendHiddenSecret messages. These messages include the secrettransform and can only be sent by the Transaction master.

Parameters:
incoming - SPMessageClass - incoming message
Returns:
result - Boolean: TRUE, if successfully handled, FALSE, if not

onrevealSecret

public boolean onrevealSecret(SPMessageClass incoming)
This method handles the incoming message to reveal a secret. The message should only come from the Transaction master and should include the secretpadded as its sole content.

Parameters:
incoming - SPMessageClass - incoming message
Returns:
result - Boolean: TRUE, if handled, FALSE, if not

pronincomingTransaction

public boolean pronincomingTransaction(SPMessageClass incoming)
This method provides the unique handlers for incoming Secret turn message types

Overrides:
pronincomingTransaction in class SPAbstractTransactionClass
Parameters:
incoming - SPMessageClass - incoming message
Returns:
result - Boolean: TRUE, if message handled by unique transaction messages, FALSE, if not.

APIrequestsendHiddenSecret

public boolean APIrequestsendHiddenSecret(java.lang.String pid,
                                          java.lang.String newsecret)
This method allows a non-transaction master to request the transaction master send a Secret. It is mainly used for remote debugging purposes.

Parameters:
pid - String - player id of the requestor
newsecret - String - the secret to be sent
Returns:
result - Boolean: TRUE, if request successfully sent, FALSE, if not

onrequestsendHiddenSecret

public void onrequestsendHiddenSecret(SPMessageClass incoming)
Handles incoming requests to create a sendHiddenSecret message

Parameters:
incoming - SPMessageClass - incoming message
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

APIrequestrevealSecret

public boolean APIrequestrevealSecret(java.lang.String pid,
                                      java.lang.String[] receivers,
                                      java.lang.String liststatus)
This method allows a third party player to request that the secret be revealed by the transaction master to the specified receiver list. This method is mainly used for remote debugging.

Parameters:
pid - String - the player id of the requestor
receivers - String[] - player ids of recievers of the secret
liststatus - String - status of the list
Returns:
result - Boolean: TRUE, if request successfully sent, FALSE, if not

onrequestrevealSecret

public void onrequestrevealSecret(SPMessageClass incoming)
This method handles incoming requests for the transaction master to create a revealSecret message to the specified receivers. It is mainly used for remote debugging purposes.

Parameters:
incoming - SPMessageClass - incoming message

buildSPawn

protected SPAbstractTransactionInterface buildSPawn()
This method provides the unique transaction creation services for spawned Secret transactions

Overrides:
buildSPawn in class SPAbstractTransactionClass
Returns:
tran - SPAbstractTransactionInterface - spawned transaction

spawnConfigure

protected boolean spawnConfigure(SPAbstractTransactionInterface a)
This method provides the unique transaction configuration services for spawned Secret transactions

Overrides:
spawnConfigure in class SPAbstractTransactionClass
Parameters:
a - SPAbstractTransactionInterface - the transaction to be spawned
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

SPgetAPI

public SPTSecretAPIClass SPgetAPI()
Gets this class's API

Returns:
classAPI - SPSecretAPIClass

getPrpadlength

public int getPrpadlength()
Getter function that returns the property: prpadlength

Returns:
prpadlength - int

getSecretpadded

public java.lang.String getSecretpadded()
Getter function that returns the property: secretpadded

Returns:
secretpadded - String

getSecrettransform

public java.lang.String getSecrettransform()
Getter function that returns the property: secrettransform

Returns:
secrettransform - String

APIcreateTransaction

public static SPTSecretClass APIcreateTransaction(SPGameAPIClass gapi,
                                                  java.lang.String transmaster,
                                                  java.lang.String[] playerIDList,
                                                  boolean privateflag)
This method allows the creation of a new Secret type, internally controlled transaction. It also sends a message to the other transaction and game participants about this new transaction.

Parameters:
gapi - SPGameAPIInterface - the game that will be associated with this transaction.
transmaster - String - player id of the master of the transaction
playerIDList - String[] - This is an array that holds the Player IDs of the players within the game that are participating in this transaction.
privateflag - boolean - This is a flag to describe whether the specific transaction is a private transaction to the non-participating Players.
Returns:
tran - SPSecretClass(but returns the actual object) - if successful, null if not

APIBcreateTransaction

public static boolean APIBcreateTransaction(SPGameAPIClass gapi,
                                            java.lang.String transmaster,
                                            java.lang.String[] playerIDList,
                                            boolean privateflag)
This method allows the creation of a new Secret type, internally controlled transaction. It also sends a message to the other transaction and game participants about this new transaction.

Parameters:
gapi - SPGameAPIInterface - the game that will be associated with this transaction.
transmaster - String - player id of the master of the transaction
playerIDList - String[] - This is an array that holds the Player IDs of the players within the game that are participating in this transaction.
privateflag - boolean - This is a flag to describe whether the specific transaction is a private transaction to the non-participating Players.
Returns:
result - Boolean: TRUE, if successful, FALSE, if not.

APITAOcreateTransaction

public static SPTSecretAPIClass APITAOcreateTransaction(SPGameAPIClass gapi,
                                                        java.lang.String transmaster,
                                                        java.lang.String[] playerIDList,
                                                        boolean privateflag)
This method allows the creation of a new Secret type, internally controlled transaction. It also sends a message to the other transaction and game participants about this new transaction.

Parameters:
gapi - SPGameAPIInterface - the game that will be associated with this transaction.
transmaster - String - player id of the master of the transaction
playerIDList - String[] - This is an array that holds the Player IDs of the players within the game that are participating in this transaction.
privateflag - boolean - This is a flag to describe whether the specific transaction is a private transaction to the non-participating Players.
Returns:
SPSecretAPIClass - if successful, null if not

gettranstype

public static java.lang.String gettranstype()
This method gets the transaction type.

Returns:
String - secret

registerTransaction

public static boolean registerTransaction()
Registers this transaction.

Returns:

createTransaction

public SPAbstractTransactionInterface createTransaction(SPGameAPIInterface gameapiobj,
                                                        java.lang.String master,
                                                        java.lang.String[] playerIDList,
                                                        boolean privateflag,
                                                        java.lang.String transactionID)
This method creates a SPSecretClass transaction.

Specified by:
createTransaction in interface SPAbstractTransactionInterface
Overrides:
createTransaction in class SPAbstractTransactionClass
Parameters:
gameapiobj - SPGameAPIInterface - the game that will be associated with this transaction.
master - String - player id of the master of the transaction
playerIDList - String[] - This is an array that holds the Player IDs of the players within the game that are participating in this transaction.
privateflag - boolean - This is a flag to describe whether the specific transaction is a private transaction to the non-participating Players.
transactionID - String - transaction id.
Returns:
SPAbstractTransactionInterface - new transaction created.