com.SecurePlay.SPSjsec1
Class SPSSecurityManagerClass

java.lang.Object
  extended bycom.SecurePlay.SPSjsec1.SPSSecurityManagerClass
All Implemented Interfaces:
SPSecurityManagerInterface

public class SPSSecurityManagerClass
extends java.lang.Object
implements SPSecurityManagerInterface

This class encapsulates all of the security functionality for the SecurePlay library It also virtualizes the services so that they could be changed out in the future. Please be aware, different platforms may encode Public/Private Key strings differently and cause interoperability problems. In general, keys can only be sent from an existing game with signatures set or from a game that does not require signed messages. This specific security manager can be used with multiple games.

Author:
IT GlobalSecure Inc.
See Also:
SecurePlay License Information
 

Constructor Summary
SPSSecurityManagerClass()
          Constructor.
 
Method Summary
 boolean addGameKeyStore(java.lang.String gameid)
          This method adds an internal key store object associated with a game.
 boolean createGamePlayerKey(java.lang.String gid, java.lang.String playerid)
          This method creates the individual private/public key pair for a player and the game.
 SPMap getGameKeyData()
          This method returns the Map object (SPMap) that includes all of the pairs: gameID, gamekeystore.
 SPMap getGamesList()
          This method returns the GamesList property.
 SPMap getRegistryList()
          This method returns the Map object (SPMap) that includes all of the pairs: registryID, registry public key.
 boolean loadGamePlayerPublicKey(java.lang.String gid, java.lang.String playerid, java.security.spec.X509EncodedKeySpec pkdsa)
          This method loads a player public key and associates it with a given game.
 boolean loadRegistryPublicKey(java.lang.String regkeyid, java.security.spec.X509EncodedKeySpec pkdsa)
          This method loads a public key for a registry for a sample PKI implementation.
 boolean onIncomingTransaction(SPMessageClass incoming)
          This method handles the unique messages associated with this specific Security Manager.
 boolean onsendGamePlayerKey(SPMessageClass incoming)
          This method handles incoming remote player public keys and loads them.
 boolean removeGameKeyStore(java.lang.String gameid)
          This method removes an internal key store associated with the specified game.
 boolean sendGamePlayerKey(java.lang.String sendinggameid, java.lang.String sendingplayerid, java.lang.String gid, java.lang.String playerid)
          This method sends a player public key for a game to the other game participants.
 boolean setGameRegistryKey(java.lang.String regkeyid, java.lang.String gameid)
          This method sets a loaded registry key to be used with a game.
 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.
 boolean SPsetGame(SPGameInterface game, java.lang.String gameID)
          This method sets the game object associated with the Security Manager.
 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 validateGameKeyStore(java.lang.String gameid)
          This method validates the contents of a game key store to see that it is ready for use in a game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPSSecurityManagerClass

public SPSSecurityManagerClass()
Constructor.

Method Detail

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.

Specified by:
SPencrypt in interface SPSecurityManagerInterface
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

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.

Specified by:
SPdecrypt in interface SPSecurityManagerInterface
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.

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.

Specified by:
SPcreateHash in interface SPSecurityManagerInterface
Parameters:
input - String
Returns:
str - String - Hash of input

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.

Specified by:
SPcreateBHash in interface SPSecurityManagerInterface
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 included signature function is a sample function - REPLACE with a function that meets your specific security requirements.

Specified by:
SPcreateSignature in interface SPSecurityManagerInterface
Parameters:
senderID - String
input - String
gameid - String
Returns:
str - String - digital signature of hashstring signed by senderID.

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 included signature function is a sample function - REPLACE with a function that meets your specific security requirements.

Specified by:
SPcreateBSignature in interface SPSecurityManagerInterface
Parameters:
senderID - String
input - String
gameid - String
Returns:
realSig - byte[] - digital signature of hashstring signed by senderID.

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. This method works on actual signatures, but make sure that you choose a set that meet your security needs. 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.

Specified by:
SPverifySignature in interface SPSecurityManagerInterface
Parameters:
signature - String
senderID - String
testhash - String
Returns:
true - Boolean - TRUE, if verification Successful, FALSE, if not.

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. This method works on actual signatures, but make sure that you choose a set that meet your security needs. 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.

Specified by:
SPverifySignature in interface SPSecurityManagerInterface
Parameters:
sigToVerify - byte[]
senderID - String
testhash - byte[]
Returns:
true - Boolean - TRUE, if verification Successful, FALSE, if not.

loadRegistryPublicKey

public boolean loadRegistryPublicKey(java.lang.String regkeyid,
                                     java.security.spec.X509EncodedKeySpec pkdsa)
This method loads a public key for a registry for a sample PKI implementation.

Parameters:
regkeyid -
pkdsa -
Returns:
boolean

setGameRegistryKey

public boolean setGameRegistryKey(java.lang.String regkeyid,
                                  java.lang.String gameid)
This method sets a loaded registry key to be used with a game.

Parameters:
regkeyid -
gameid -
Returns:
boolean

loadGamePlayerPublicKey

public boolean loadGamePlayerPublicKey(java.lang.String gid,
                                       java.lang.String playerid,
                                       java.security.spec.X509EncodedKeySpec pkdsa)
This method loads a player public key and associates it with a given game. Typically, this method is used for non-internal players.

Parameters:
gid -
playerid -
pkdsa -
Returns:
boolean

createGamePlayerKey

public boolean createGamePlayerKey(java.lang.String gid,
                                   java.lang.String playerid)
This method creates the individual private/public key pair for a player and the game.

Parameters:
gid -
playerid -
Returns:
boolean

sendGamePlayerKey

public boolean sendGamePlayerKey(java.lang.String sendinggameid,
                                 java.lang.String sendingplayerid,
                                 java.lang.String gid,
                                 java.lang.String playerid)
This method sends a player public key for a game to the other game participants.


onsendGamePlayerKey

public boolean onsendGamePlayerKey(SPMessageClass incoming)
This method handles incoming remote player public keys and loads them.


addGameKeyStore

public boolean addGameKeyStore(java.lang.String gameid)
This method adds an internal key store object associated with a game.

Parameters:
gameid -
Returns:
Boolean - TRUE, if successfull; FALSE, if not.

removeGameKeyStore

public boolean removeGameKeyStore(java.lang.String gameid)
This method removes an internal key store associated with the specified game.

Parameters:
gameid -
Returns:
Boolean - TRUE, if successfull; FALSE, if not.

validateGameKeyStore

public boolean validateGameKeyStore(java.lang.String gameid)
This method validates the contents of a game key store to see that it is ready for use in a game.

Parameters:
gameid -
Returns:
Boolean - TRUE, if successfull; FALSE, if not.

getGameKeyData

public SPMap getGameKeyData()
This method returns the Map object (SPMap) that includes all of the pairs: gameID, gamekeystore.

Returns:
SPMap - GameKeyData

getRegistryList

public SPMap getRegistryList()
This method returns the Map object (SPMap) that includes all of the pairs: registryID, registry public key.

Returns:
SPMap - RegistryList.

onIncomingTransaction

public boolean onIncomingTransaction(SPMessageClass incoming)
This method handles the unique messages associated with this specific Security Manager.

Specified by:
onIncomingTransaction in interface SPSecurityManagerInterface

SPsetGame

public boolean SPsetGame(SPGameInterface game,
                         java.lang.String gameID)
Description copied from interface: SPSecurityManagerInterface
This method sets the game object associated with the Security Manager. Note, it may be possible in certain implementations to associate multiple games with one security manager.

Specified by:
SPsetGame in interface SPSecurityManagerInterface
Parameters:
game -
gameID -
Returns:
boolean

getGamesList

public SPMap getGamesList()
This method returns the GamesList property.

Returns:
SPMap - Games List associated with this library.