be.SIRAPRISE.messages
Class ServerMessage

java.lang.Object
  extended by be.SIRAPRISE.messages.ServerMessage
Direct Known Subclasses:
ServerErrorMessage, ServerInputMessage, ServerOutputMessage

public abstract class ServerMessage
extends java.lang.Object

The ServerMessage class is an abstract class defining all possible messages sent to/by the SIRA_PRISE server

Author:
Erwin Smout

Method Summary
 int getMessageTypeID()
          Gets the message type identification number
static ServerMessage readMessage(java.io.DataInputStream in, be.SIRAPRISE.security.ProprietaryOrJCECipher cryptoProtocol, java.security.Signature signingProtocol, java.security.PublicKey publicKey)
          The method used by readers to obtain a (structured) message from the given stream.
 void sendMessage(java.io.DataOutputStream out, java.security.Signature signingProtocol, Signer signer, be.SIRAPRISE.security.ProprietaryOrJCECipher cryptoProtocol)
          Sends this message to the given output stream using the given signing and encryption settings.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readMessage

public static ServerMessage readMessage(java.io.DataInputStream in,
                                        be.SIRAPRISE.security.ProprietaryOrJCECipher cryptoProtocol,
                                        java.security.Signature signingProtocol,
                                        java.security.PublicKey publicKey)
                                 throws java.io.IOException,
                                        ErrorMessageException,
                                        CommunicationProtocolException
The method used by readers to obtain a (structured) message from the given stream.

Parameters:
in - The inputstream from which the ServerMessage to be returned is to be constructed
cryptoProtocol - The protocol to be used for decryption of what arrives after the byte count
signingProtocol - the Signature used to verify the message signature
publicKey - the public key used to verify the signature
Returns:
The ServerMessage read from the given stream
Throws:
java.io.IOException
ErrorMessageException
CommunicationProtocolException

getMessageTypeID

public final int getMessageTypeID()
Gets the message type identification number

Returns:
the message type identification number

sendMessage

public final void sendMessage(java.io.DataOutputStream out,
                              java.security.Signature signingProtocol,
                              Signer signer,
                              be.SIRAPRISE.security.ProprietaryOrJCECipher cryptoProtocol)
                       throws java.io.IOException,
                              CommunicationProtocolException
Sends this message to the given output stream using the given signing and encryption settings.

Parameters:
out - The outputStream to which the message is to be written
signingProtocol - The Signature object needed to compute the signature for the message, or null if no signing is required.
signer - The Signer object that will compute the message signature using the given signingProtocol
cryptoProtocol - The encryption object that will computed the encrypted message if encryption is required, null if no encryption is required.
Throws:
CommunicationProtocolException -
  • If any resource needed for computing a signature for this message (such as e.g. a private key), could not be found or turns out to be invalid
  • If any problem occurred during computation of the signature
java.io.IOException