com.SecurePlay
Interface SPGameInterface

All Known Implementing Classes:
SPGameClass

public interface SPGameInterface

This is the interface for all Game classes

Author:
IT GlobalSecure
See Also:
SecurePlay License Information
 

Method Summary
 boolean addComms(java.lang.String commsID)
          This method associates a comms service specified by the commsID string to a game instance.
 boolean addPlayer(java.lang.String pid)
          This method safely adds an existing Player, specified by the playerID to the game instance.
 boolean addTransaction(SPAbstractTransactionInterface transObj)
          This safely adds a transaction to a game instance and appropriately updates the game state.
 boolean attach(java.lang.String gid, SecurePlayClass lib, java.lang.String master, boolean signaturepolicy, boolean encryptionpolicy, SPLogInterface log, SPSecurityManagerInterface security)
          This method attaches an empty game object instance and configures it for use in the SecurePlay library as a game NOTE: This method does not set the classAPI because it is an attached game.
 boolean closeTransaction(java.lang.String transID)
          Safely removes a transaction from a game instance.
 boolean gameComplete()
          This method allows external entities to review the status of the game instance without directly accessing its internals.
 SPCommsManagerClass getCommsManager()
          Gets the comms manager object
 SPGameAPIInterface getGameAPI()
          This method returns the handler for the Game API object.
 java.lang.String getGameID()
          Gets the game id
 SPPlayerInterface getGamePlayer(java.lang.String playerID)
          This method returns the player object specified by the playerID.
 SPAbstractTransactionInterface getGameTransaction(java.lang.String tid)
          This method returns a specific transaction associated with a given game instance.
 java.lang.String getMaster()
          Gets the master
 java.lang.String[] getPlayerIDList()
          Gets the player id list
 SecurePlayClass getSecurePlay()
          This method returns the unique SecurePlay library object associated with the game instance object.
 SPSecurityManagerInterface getSecurityManager()
          This method returns the security manager class associated with this game.
 java.lang.String getTransactionID()
          Gets the transaction id
 boolean incrementBasicGameTransactionCount(int count)
          This method increments the game’s transaction counter to support certain licensing models
 boolean isPlayerInternal(java.lang.String pid)
          Checks to see if the player is internal
 boolean onendGame(SPMessageClass messObj)
          This method safely ends the local game instance.
 void onIncomingTransaction(SPMessageClass messObj)
          This method is the generic handler for incoming Game transaction methods.
 boolean removeComms(java.lang.String commsID)
          This method removes the association of a communications service with a game instance.
 boolean removePlayer(java.lang.String pid)
          This method safely removes a Player instance from an existing Game Instance.
 boolean setPlayerComms(java.lang.String playerID, java.lang.String commsID, boolean relayflag)
          This method associates a specific player instance, specified by the playerID, with a specific communications service, specified by the commsID.
 byte[] SPcreateBHash(java.lang.String input, java.lang.String gameid)
          This is a wrapper function for creating a hash of a string.
 byte[] SPcreateBSignature(java.lang.String senderID, byte[] input, java.lang.String gameid)
          This is a wrapper function for creating a digital signature based on an existing hashed string and a Sender ID.
 java.lang.String SPcreateHash(java.lang.String input, java.lang.String gameid)
          This is a wrapper function for creating a hash of a string.
 java.lang.String SPcreateSignature(java.lang.String senderID, java.lang.String input, java.lang.String gameid)
          This is a wrapper function for creating a digital signature based on an existing hashed string and a Sender ID.
 java.lang.String[] SPdecrypt(java.lang.String[] input, java.lang.String senderID, java.lang.String[] recvrs, java.lang.String gameID, java.lang.String messageID)
          This is a placeholder for an decryption function.
 java.lang.String[] SPencrypt(java.lang.String[] input, java.lang.String senderID, java.lang.String[] recvrs, java.lang.String gameID, java.lang.String messageID)
          This is a placeholder for an encryption function.
 void SPnotify(java.lang.String eventdescription, java.lang.String[] args)
          This method notifies the Listeners of events
 boolean SPverifySignature(byte[] sigToVerify, java.lang.String senderID, byte[] testhash, java.lang.String gameid)
          This is a wrapper for a digital signature verification function.
 boolean SPverifySignature(java.lang.String signature, java.lang.String senderID, java.lang.String testhash, java.lang.String gameid)
          This is a wrapper for a digital signature verification function.
 boolean transactionincluded(java.lang.String tid)
          This method checks the specified transaction ID against the currently included transaction IDs in the game instance.
 

Method Detail

getGameAPI

public SPGameAPIInterface getGameAPI()
This method returns the handler for the Game API object.

Returns:
classAPI - SPAbstractGameAPI - Game API object handler

addPlayer

public boolean addPlayer(java.lang.String pid)
This method safely adds an existing Player, specified by the playerID to the game instance.

Parameters:
pid - String - the id of the player to be added
Returns:
result - Boolean: TRUE, if successful, FALSE, if no

removePlayer

public boolean removePlayer(java.lang.String pid)
This method safely removes a Player instance from an existing Game Instance.

Parameters:
pid - String - id of the player to be removed
Returns:
result - Boolean: TRUE, if successful, FALSE, if not.

setPlayerComms

public boolean setPlayerComms(java.lang.String playerID,
                              java.lang.String commsID,
                              boolean relayflag)
This method associates a specific player instance, specified by the playerID, with a specific communications service, specified by the commsID. For certain remote players, a relay service is supported to allow messages to be forwarded. NOTE: there is a reserved comms service "internal" for player instances that are included in the local application session.

Parameters:
playerID - String - id of the player to be added
commsID - String - id of the comms object to be added
relayflag - Boolean - relay flag
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

getGamePlayer

public SPPlayerInterface getGamePlayer(java.lang.String playerID)
This method returns the player object specified by the playerID.

Parameters:
playerID - String - the id of the player to get
Returns:
player - SPPlayerInterface(but actually is SPPlayerClass) - the game player object handler or an empty instance of the class, if the player is not present

gameComplete

public boolean gameComplete()
This method allows external entities to review the status of the game instance without directly accessing its internals.

Returns:
result - Boolean: TRUE, if gamestatus is "complete", FALSE, if not

addComms

public boolean addComms(java.lang.String commsID)
This method associates a comms service specified by the commsID string to a game instance.

Parameters:
commsID - String - id of the comms to be added
Returns:
result - Boolean: TRUE, if gamestatus is "complete", FALSE, if not

removeComms

public boolean removeComms(java.lang.String commsID)
This method removes the association of a communications service with a game instance.

Parameters:
commsID - String - id of the comms to be removed
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

addTransaction

public boolean addTransaction(SPAbstractTransactionInterface transObj)
This safely adds a transaction to a game instance and appropriately updates the game state.

Parameters:
transObj - SPAbstractTransactionInterface - the transaction Object handler
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

closeTransaction

public boolean closeTransaction(java.lang.String transID)
Safely removes a transaction from a game instance.

Parameters:
transID - String - the id of the transaction to be closed
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

getGameTransaction

public SPAbstractTransactionInterface getGameTransaction(java.lang.String tid)
This method returns a specific transaction associated with a given game instance.

Parameters:
tid - String - identifier for transaction object
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

transactionincluded

public boolean transactionincluded(java.lang.String tid)
This method checks the specified transaction ID against the currently included transaction IDs in the game instance.

Parameters:
tid - String - the id of the transaction in question
Returns:
result Boolean: TRUE, if included, FALSE, if not

incrementBasicGameTransactionCount

public boolean incrementBasicGameTransactionCount(int count)
This method increments the game’s transaction counter to support certain licensing models

Parameters:
count - int - number of increments
Returns:
Boolean TRUE, if successful, FALSE, if not

onIncomingTransaction

public void onIncomingTransaction(SPMessageClass messObj)
This method is the generic handler for incoming Game transaction methods.

Parameters:
messObj - SPMessageClass - incoming Message Object

isPlayerInternal

public boolean isPlayerInternal(java.lang.String pid)
Checks to see if the player is internal

Parameters:
pid - String - id of the player to be checked
Returns:
result - Boolean: TRUE, if successful, FALSE, if not

attach

public boolean attach(java.lang.String gid,
                      SecurePlayClass lib,
                      java.lang.String master,
                      boolean signaturepolicy,
                      boolean encryptionpolicy,
                      SPLogInterface log,
                      SPSecurityManagerInterface security)
This method attaches an empty game object instance and configures it for use in the SecurePlay library as a game NOTE: This method does not set the classAPI because it is an attached game. The attached game does not have to behave like AbstractGame.

Parameters:
gid - String - game id
lib - SecurePlayClass - the secure play library
master - String - the master of the game
signaturepolicy - boolean - signature policy
encryptionpolicy - boolean - encryption policy
log -
security -

getGameID

public java.lang.String getGameID()
Gets the game id

Returns:
str - String - the game id

onendGame

public boolean onendGame(SPMessageClass messObj)
This method safely ends the local game instance.

Parameters:
messObj - SPMessageClass - incoming Message Object * @return result - Boolean: TRUE, if successful, FALSE, if not

getPlayerIDList

public java.lang.String[] getPlayerIDList()
Gets the player id list

Returns:
pidlist - String[] - the player id list

getCommsManager

public SPCommsManagerClass getCommsManager()
Gets the comms manager object

Returns:
comms - SPCommsManagerClass - the comms manager object

getMaster

public java.lang.String getMaster()
Gets the master

Returns:
master String - the master

getTransactionID

public java.lang.String getTransactionID()
Gets the transaction id

Returns:
tranid - String - the transaction id

getSecurePlay

public SecurePlayClass getSecurePlay()
This method returns the unique SecurePlay library object associated with the game instance object.

Returns:
spc - SecurePlayLibrary - the secure play library

SPcreateBHash

public byte[] SPcreateBHash(java.lang.String input,
                            java.lang.String gameid)
This is a wrapper function for creating a hash of a string. This reference implementation includes a MD5 hash.

Parameters:
input - String
Returns:
str - String - Hash of input

SPcreateBSignature

public byte[] SPcreateBSignature(java.lang.String senderID,
                                 byte[] input,
                                 java.lang.String gameid)
This is a wrapper function for creating a digital signature based on an existing hashed string and a Sender ID. The reference implementation currently uses an MD5 function to approximate performance of a real signature. The included signature function is a sample function - REPLACE with a function that meets your specific security requirements.

Parameters:
senderID - String
input - String
gameid - String
Returns:
realSig - byte[] - digital signature of hashstring signed by senderID.

SPcreateHash

public java.lang.String SPcreateHash(java.lang.String input,
                                     java.lang.String gameid)
This is a wrapper function for creating a hash of a string. This reference implementation includes a MD5 hash.

Parameters:
input - String
Returns:
str - String - Hash of input

SPcreateSignature

public java.lang.String SPcreateSignature(java.lang.String senderID,
                                          java.lang.String input,
                                          java.lang.String gameid)
This is a wrapper function for creating a digital signature based on an existing hashed string and a Sender ID. The reference implementation currently uses an MD5 function to approximate performance of a real signature. The included signature function is a sample function - REPLACE with a function that meets your specific security requirements.

Parameters:
senderID - String
input - String
gameid - String
Returns:
str - String - digital signature of hashstring signed by senderID.

SPdecrypt

public java.lang.String[] SPdecrypt(java.lang.String[] input,
                                    java.lang.String senderID,
                                    java.lang.String[] recvrs,
                                    java.lang.String gameID,
                                    java.lang.String messageID)
This is a placeholder for an decryption function. An actual encryption function is the responsibility of the game implementer.

Parameters:
input - String[] - input message body to be decrypted
senderID - String - sender id
recvrs - String[] - receiver id list
gameID - String - game id
messageID - String - message id
Returns:
mess - String[] - String array of decrypted messagebody.

SPencrypt

public java.lang.String[] SPencrypt(java.lang.String[] input,
                                    java.lang.String senderID,
                                    java.lang.String[] recvrs,
                                    java.lang.String gameID,
                                    java.lang.String messageID)
This is a placeholder for an encryption function. An actual encryption function is the responsibility of the game implementer.

Parameters:
input - String[] - message body to be encrypted
senderID - String - sender id
recvrs - String[] - receiver id list
gameID - String - game id
messageID - String - message id
Returns:
mess - String[] - Encrypted message body

SPverifySignature

public boolean SPverifySignature(byte[] sigToVerify,
                                 java.lang.String senderID,
                                 byte[] testhash,
                                 java.lang.String gameid)
This is a wrapper for a digital signature verification function. CAREFUL CHOICE OF ACTUAL DIGITAL SIGNATURES AND VERIFICATION IS CRITICAL. SELECTION OF APPROPRIATE FUNCTIONS AND IMPLEMENTATION MAY HAVE A SUBSTANTIAL IMPACT ON THE SECURITY AND PERFORMANCE OF A GAME IMPLEMENTATION.

Parameters:
sigToVerify - byte[]
senderID - String
testhash - String
Returns:
true - Boolean - TRUE, if verification Successful, FALSE, if not.

SPverifySignature

public boolean SPverifySignature(java.lang.String signature,
                                 java.lang.String senderID,
                                 java.lang.String testhash,
                                 java.lang.String gameid)
This is a wrapper for a digital signature verification function. CAREFUL CHOICE OF ACTUAL DIGITAL SIGNATURES AND VERIFICATION IS CRITICAL. SELECTION OF APPROPRIATE FUNCTIONS AND IMPLEMENTATION MAY HAVE A SUBSTANTIAL IMPACT ON THE SECURITY AND PERFORMANCE OF A GAME IMPLEMENTATION.

Parameters:
signature - String
senderID - String
testhash - String
Returns:
true - Boolean - TRUE, if verification Successful, FALSE, if not.

getSecurityManager

public SPSecurityManagerInterface getSecurityManager()
This method returns the security manager class associated with this game.

Returns:
SPSecurityManagerInterface

SPnotify

public void SPnotify(java.lang.String eventdescription,
                     java.lang.String[] args)
This method notifies the Listeners of events

Parameters:
eventdescription -
args - - String[] - arguments