SecurePlayLibray J2SE
v2.1

com.SecurePlay
Class SPMessageClass

java.lang.Object
  extended bycom.SecurePlay.SPMessageClass

public class SPMessageClass
extends java.lang.Object

This is a "game-level" message that is sent between SecurePlay library instances for each Player.

Author:
IT GlobalSecure
See Also:
SecurePlay License Information
 

Field Summary
private  boolean encryptedflag
          The "encryptedflag" determines whether the message has been encrypted so that it can be handled appropriately.
private  java.lang.String gameID
          The gameID is a unique ID associated with the game.
(package private) static long lasttimestamp
           
private  java.lang.String[] message
          This string array holds the message body.
private  java.lang.String messageID
          The message ID is a unique message identifer at the game instance level.
private  java.lang.String messType
          This is the most important element of a message - it tells the receiving SecurePlay library instance where to hand the message off to for further processing.
private  SPUEPrivatePolicy privateflag
          This flag describes whether the message is a private message (i.e., that it will be routed only to a specific set of recipients) denoted by "P", or public (that is will be routed to all players) denoted by "A" or an alternate message sent to the other game recipients not part of the private transaction denoted by "Q".
private  java.lang.String[] receivers
          This is the list of receivers of a message.
(package private)  java.lang.String releaseversion
          IT GlobalSecure release version.
private  java.lang.String senderID
          The senderID is the unique identifier of the sender Player (instance of SPPlayerClass) of a game message.
private  byte[] signature
          The signature is the either the hash of the "prhashableMessage()" portions of the message or a digital signature function applied to the message hash.
private  boolean signedflag
          This provides a flag to determine if the message has been digitally signed.
private  java.lang.String transactionID
          This is the unique identifier of the transaction associated with the message.
 
Constructor Summary
SPMessageClass()
          Default Constructor.
SPMessageClass(java.lang.String INgameID, java.lang.String INtransactionID, java.lang.String INsenderID, java.lang.String[] INreceiverIDlist, java.lang.String INmessType, boolean INsignedflag, SPUEPrivatePolicy INprivateflag, boolean INencryptedflag, java.lang.String[] INmessagebody, byte[] INsignature, java.lang.String INmessID, SPSecurityManagerInterface game)
          Constructs an overloaded SPMessageClass
 
Method Summary
private  void buildmessage(java.lang.String INgameID, java.lang.String INtransactionID, java.lang.String INsenderID, java.lang.String[] INreceiverIDlist, java.lang.String INmessType, boolean INsignedflag, SPUEPrivatePolicy INprivateflag, boolean INencryptedflag, java.lang.String[] INmessagebody, byte[] INsignature, java.lang.String INmessID, SPSecurityManagerInterface secman)
           
 boolean decrypt(SPSecurityManagerInterface secman)
          This method safely decrypts the message string and loads the results into the message body array using the global SPdecrypt function.
 boolean encrypt(SPSecurityManagerInterface secman)
          This method safely encrypts the message body string using the global SPencrypt function.
 byte[] getBSignature()
          Gets the signature of the message.
 boolean getEncryptedFlag()
          Gets the enrypted flag of the message.
 java.lang.String getGameID()
          Gets the id of the game associated with the message.
 java.lang.String[] getMessageBody()
          Gets the message body.
 java.lang.String getMessageID()
          Gets the message id.
 long getMessageIDcount()
          This method returns the count value from the message ID
 java.lang.String getMessageType()
          Gets the message type.
 SPUEPrivatePolicy getPrivateflag()
          Gets the private policy of the message.
 java.lang.String[] getReceiverIDlist()
          Gets the reciever id list of the message.
 java.lang.String getSenderID()
          Gets the senderID property of the class.
 java.lang.String getSignature()
          Gets the signature of the message.
 boolean getSignedFlag()
          Gets the signed flag of the message.
 java.lang.String getTransactionID()
          Gets the id of the transaction associated with the message.
static java.lang.String newMessageID(java.lang.String gameID, java.lang.String transactionID, java.lang.String senderID)
          This method generates a messageID for messages that need an ID generated.
private  java.lang.String prhashableMessage()
          Creates a string to be used by the hash function.
 java.lang.String validateMessageLoad()
          This method validates a SPMessageClass instance to check that it is well-formed - that all of the parameters are set from a SPMessageClass perspective.
 boolean verifyMessageSignature(SPSecurityManagerInterface secman)
          This method verifies the signature associated with a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gameID

private java.lang.String gameID
The gameID is a unique ID associated with the game. It is generated externally to the SecurePlay library.


transactionID

private java.lang.String transactionID
This is the unique identifier of the transaction associated with the message. It is used to key the message processor to route the incoming message to the proper transaction object.


senderID

private java.lang.String senderID
The senderID is the unique identifier of the sender Player (instance of SPPlayerClass) of a game message.


receivers

private java.lang.String[] receivers
This is the list of receivers of a message.


messType

private java.lang.String messType
This is the most important element of a message - it tells the receiving SecurePlay library instance where to hand the message off to for further processing.


signedflag

private boolean signedflag
This provides a flag to determine if the message has been digitally signed. NOTE: as a default, the SecurePlay library does attach a hash of the message that is used in this attribute.


encryptedflag

private boolean encryptedflag
The "encryptedflag" determines whether the message has been encrypted so that it can be handled appropriately. Typically, locally generated messages are not stored in the message log in encrypted form nor are remotely generated. Encryption occurs after signing so that signatures will not be affected if the encryption has been removed. The encrypted flag can have two values: true (for encrypted) and false (for not).


privateflag

private SPUEPrivatePolicy privateflag
This flag describes whether the message is a private message (i.e., that it will be routed only to a specific set of recipients) denoted by "P", or public (that is will be routed to all players) denoted by "A" or an alternate message sent to the other game recipients not part of the private transaction denoted by "Q".


message

private java.lang.String[] message
This string array holds the message body. Message body elements should consists solely of strings of alphanumeric characters 0..9A..Za..z.


signature

private byte[] signature
The signature is the either the hash of the "prhashableMessage()" portions of the message or a digital signature function applied to the message hash.


messageID

private java.lang.String messageID
The message ID is a unique message identifer at the game instance level. Thus, messageIDs should be unique within a specific game.


releaseversion

final java.lang.String releaseversion
IT GlobalSecure release version.


lasttimestamp

static long lasttimestamp
Constructor Detail

SPMessageClass

public SPMessageClass()
Default Constructor. Used in some cases where message class needs to be initialized as a type specifier.


SPMessageClass

public SPMessageClass(java.lang.String INgameID,
                      java.lang.String INtransactionID,
                      java.lang.String INsenderID,
                      java.lang.String[] INreceiverIDlist,
                      java.lang.String INmessType,
                      boolean INsignedflag,
                      SPUEPrivatePolicy INprivateflag,
                      boolean INencryptedflag,
                      java.lang.String[] INmessagebody,
                      byte[] INsignature,
                      java.lang.String INmessID,
                      SPSecurityManagerInterface game)
Constructs an overloaded SPMessageClass

Parameters:
INgameID - String - this is the ID for the game that this message is associated with
INtransactionID - - this is the ID of the transaction that this message is associated with
INsenderID - String - this is the identity of the sender of the message
INreceiverIDlist - String[] - ids of the recievers
INmessType - String - this is the Message Type of the message (typically one of the basic game transaction methods)
INsignedflag - boolean - a flag to determine if the message has been digitally signed
INprivateflag - SPUtilPrivatePolicy -
INencryptedflag - boolean - This flag describes whether the message is a private message denoted by "P", or public denoted by "A" or an alternate message sent to the other game recipients not part of the private transaction denoted by "Q".
INmessagebody - String[] - the message
INsignature - String - The signature is the either the hash of the "prhashableMessage()" portions of the message or a digital signature function applied to the message hash.
INmessID - String - The message ID is a unique message identifer at the game instance level.
game - SPSecurityManagerInterface - the security manager associated with this message.
Method Detail

buildmessage

private void buildmessage(java.lang.String INgameID,
                          java.lang.String INtransactionID,
                          java.lang.String INsenderID,
                          java.lang.String[] INreceiverIDlist,
                          java.lang.String INmessType,
                          boolean INsignedflag,
                          SPUEPrivatePolicy INprivateflag,
                          boolean INencryptedflag,
                          java.lang.String[] INmessagebody,
                          byte[] INsignature,
                          java.lang.String INmessID,
                          SPSecurityManagerInterface secman)

newMessageID

public static java.lang.String newMessageID(java.lang.String gameID,
                                            java.lang.String transactionID,
                                            java.lang.String senderID)
This method generates a messageID for messages that need an ID generated.

Parameters:
gameID -
transactionID -
senderID -
Returns:
String

getMessageIDcount

public long getMessageIDcount()
This method returns the count value from the message ID

Returns:
long

validateMessageLoad

public java.lang.String validateMessageLoad()
This method validates a SPMessageClass instance to check that it is well-formed - that all of the parameters are set from a SPMessageClass perspective. NOTE: it does not validate that the content of a message is valid.

Returns:
errorinfo - String - errorinfo string. If the incoming message is valid, the empty string "" is returned

verifyMessageSignature

public boolean verifyMessageSignature(SPSecurityManagerInterface secman)
This method verifies the signature associated with a message. Note, if the signedflag is set to TRUE, a real digital signature is used as specified by the game configuration (see SPGame). If the signedflag is set to FALSE, then the message is checked against the hash function.

Returns:
result - Boolean: True if signature verifies, otherwise, False.

prhashableMessage

private java.lang.String prhashableMessage()
Creates a string to be used by the hash function. This string includes the portions of the message instance that are to be included in the hash function.

Returns:
hashable - String - hashable message tured into a string

getGameID

public java.lang.String getGameID()
Gets the id of the game associated with the message.

Returns:
gameID - String - game id

getTransactionID

public java.lang.String getTransactionID()
Gets the id of the transaction associated with the message.

Returns:
transactionID - String - transaction id

getSenderID

public java.lang.String getSenderID()
Gets the senderID property of the class.

Returns:
senderID - String - sender id

getMessageType

public java.lang.String getMessageType()
Gets the message type.

Returns:
messType - String - message type.

getSignedFlag

public boolean getSignedFlag()
Gets the signed flag of the message.

Returns:
signedflag - Boolean - TRUE, if signed flag is true, FALSE, if signed flag is false

getEncryptedFlag

public boolean getEncryptedFlag()
Gets the enrypted flag of the message.

Returns:
encryptedflag - Boolean - TRUE, if enrypted flag is true, FALSE, if enrypted flag is false

getPrivateflag

public SPUEPrivatePolicy getPrivateflag()
Gets the private policy of the message.

Returns:
pf - SPUtilPrivatePolicy - the private policy.
See Also:
SPUEPrivatePolicy

getMessageID

public java.lang.String getMessageID()
Gets the message id.

Returns:
messageID - String - message id

getSignature

public java.lang.String getSignature()
Gets the signature of the message.

Returns:
signature - String - the signature of the message.

getBSignature

public byte[] getBSignature()
Gets the signature of the message.

Returns:
signature - byte[] - the signature of the message.

getReceiverIDlist

public java.lang.String[] getReceiverIDlist()
Gets the reciever id list of the message.

Returns:
sv - String[] - array of reciever ids.

getMessageBody

public java.lang.String[] getMessageBody()
Gets the message body.

Returns:
v - String[] - gets the message body of the message.

encrypt

public boolean encrypt(SPSecurityManagerInterface secman)
This method safely encrypts the message body string using the global SPencrypt function.

Returns:
Boolean - TRUE, if successful, FALSE, if not

decrypt

public boolean decrypt(SPSecurityManagerInterface secman)
This method safely decrypts the message string and loads the results into the message body array using the global SPdecrypt function.

Returns:
result - Boolean: TRUE, if successful, FALSE, if not.

SecurePlayLibray J2SE
v2.1

2006 Copyright Filed by IT GlobalSecure, Inc. All Rights Reserved. Not to be used without authorization by Author. SecurePlay, IT GlobalSecure, and IT Armor are registered trademarks by IT GlobalSecure, Inc. Software protected by software license, and one or more the following U.S. and International patent numbers: U.S. Patent 6,030,288, U.S. Patent 6,165,072, European Patent Office EP1016049A1,and World Intellectual Property Organization WO9912135C1 and additional filings worldwide.