externalInformationPort
Class ExternalInformationPortController

java.lang.Object
  extended by externalInformationPort.ExternalInformationPortController
All Implemented Interfaces:
ExternalInformationPortInterface

public class ExternalInformationPortController
extends java.lang.Object
implements ExternalInformationPortInterface

Controller class of component ExternalInformationPort. Implements the architecture interface ExternalInformationPortInterface.

Used for Information (for example a public key) exchange with "external" communication partners (for example other mixes or clients). This component doesn't affect the sending of mix messages directly (That's done by the InputOutputHandler: see architectureInterface.InputOutputHandlerInterface).

Each exchangeable type of information is specified in the enumeration Information.

Author:
Karl-Peter Fuchs

Field Summary
private  InformationProvider informationProvider
          Provides information about this mix (cascade).
private static InternalInformationPortController internalInformationPort
          Reference on component InternalInformationPort.
private static java.util.logging.Logger LOGGER
          Logger used to log and display information.
private  MessageProcessorController messageProcessor
          Reference on MessageProcessor component.
 
Constructor Summary
ExternalInformationPortController()
          Generates a new ExternalInformationPort component.
 
Method Summary
 void acceptRequests()
          Make component start listening for requests (on communication channel).
 java.lang.Object getInformation(java.net.InetAddress informationProviderAddress, int informationProviderPort, Information informationOfInterest)
          Generic method to receive some Information from a specified ExternalInformationPort component.
 java.lang.Object getInformation(java.net.InetAddress informationProviderAddress, int informationProviderPort, Information informationOfInterest, byte[] data)
          Generic method to receive some Information from a specified ExternalInformationPort component, sending the bypassed data.
 java.lang.Object[] getInformationFromAll(java.net.InetAddress informationProviderAddress, int informationProviderPort, Information informationOfInterest)
          Generic method to receive some Information from several ExternalInformationPort components.
 java.lang.Object[] getInformationFromAll(java.net.InetAddress informationProviderAddress, int informationProviderPort, Information informationOfInterest, byte[] data)
          Generic method to receive some Information from several ExternalInformationPort components, sending the bypassed data.
private  javax.crypto.spec.IvParameterSpec getInterMixIV(java.net.InetAddress nexMixInformationProviderAddress, int nexMixInformationProviderPort)
          Retrieves the specified mix' IV.
private  javax.crypto.SecretKey getInterMixKey(java.net.InetAddress nexMixInformationProviderAddress, int nexMixInformationProviderPort)
          Retrieves the specified's mix SYMMETRIC_KEY.
private  java.net.InetAddress getNextMixAddress(java.net.InetAddress informationProviderAddress, int informationProviderPort)
          Retrieves the specified mix' NEXT_MIX_ADDRESS.
private  int getNextMixInfoPort(java.net.InetAddress informationProviderAddress, int informationProviderPort)
          Retrieves the specified mix' NEXT_MIX_INFO_PORT.
private  java.security.PublicKey getPublicKey(java.net.InetAddress informationProviderAddress, int informationProviderPort)
          Retrieves the specified mix' PUBLIC_KEY.
private  java.security.PublicKey[] getPublicKeys(java.net.InetAddress informationProviderAddress, int informationProviderPort)
          Retrieves the PUBLIC_KEYs of all mixes in the specified cascade.
 void initialize()
          Initialization method for this component.
 void initialize(java.security.PublicKey publicKey, MessageProcessorController messageProcessor)
          Initialization method for this component.
 void setInterMixIVWithPreviousMix(javax.crypto.spec.IvParameterSpec interMixIV)
          Makes the bypassed initialization vector available via InformationProvider.
 void setInterMixKeyWithPreviousMix(javax.crypto.SecretKey interMixKey)
          Makes the bypassed key available via InformationProvider.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

internalInformationPort

private static InternalInformationPortController internalInformationPort
Reference on component InternalInformationPort. Used to display and/or log data and read general settings.


LOGGER

private static final java.util.logging.Logger LOGGER
Logger used to log and display information.


messageProcessor

private MessageProcessorController messageProcessor
Reference on MessageProcessor component. Used to encrypt certain kinds of Information.


informationProvider

private InformationProvider informationProvider
Provides information about this mix (cascade).

Constructor Detail

ExternalInformationPortController

public ExternalInformationPortController()
Generates a new ExternalInformationPort component.

Used for Information (for example a public key) exchange with "external" communication partners (for example other mixes or clients). This component doesn't affect the sending of mix messages directly (That's done by the InputOutputHandler: see architectureInterface.InputOutputHandlerInterface).

Each exchangeable type of information is specified in the enumeration Information.

Component can't be used before calling initialize().

See Also:
initialize(), initialize(PublicKey, MessageProcessorController)
Method Detail

initialize

public void initialize(java.security.PublicKey publicKey,
                       MessageProcessorController messageProcessor)
Initialization method for this component. Makes this component capable of receiving AND providing Information (see initialize() for receival only). Must be called before using an instance of this class for anything but dispensing references on the instance itself.

Parameters:
publicKey - The mix' public key, this object belongs to (will be made available via InformationProvider).
messageProcessor - Used to encrypt certain kinds of Information.
See Also:
initialize()

initialize

public void initialize()
Initialization method for this component. Makes this component capable of receiving BUT NOT providing Information from a communication partner's ExternalInformationPort (see initialize(PublicKey, MessageProcessorController) for providing Information, too). Must be called before using an instance of this class for anything but dispensing references on the instance itself.

See Also:
initialize(PublicKey, MessageProcessorController)

setInterMixKeyWithPreviousMix

public void setInterMixKeyWithPreviousMix(javax.crypto.SecretKey interMixKey)
Makes the bypassed key available via InformationProvider. This key is used to encrypt data between mixes.

Parameters:
interMixKey - Key used to encrypt data between mixes.

setInterMixIVWithPreviousMix

public void setInterMixIVWithPreviousMix(javax.crypto.spec.IvParameterSpec interMixIV)
Makes the bypassed initialization vector available via InformationProvider. This initialization vector is used to encrypt data between mixes.

Parameters:
interMixIV - Initialization vector used to encrypt data between mixes.

getInformation

public java.lang.Object getInformation(java.net.InetAddress informationProviderAddress,
                                       int informationProviderPort,
                                       Information informationOfInterest)
                                throws InformationRetrieveException
Generic method to receive some Information from a specified ExternalInformationPort component.

If communication channel isn't safe, but transmitted data is sensitive, cryptographic measures (like authentication and encryption) should be applied.

Specified by:
getInformation in interface ExternalInformationPortInterface
Parameters:
informationProviderAddress - Address of the ExternalInformationPort component to receive data from.
informationProviderPort - Port the ExternalInformationPort component to receive data from runs on.
informationOfInterest - Type of Information, that shall be received.
Returns:
The requested Information .
Throws:
InformationRetrieveException - Thrown, when requested Information not available.

getInformation

public java.lang.Object getInformation(java.net.InetAddress informationProviderAddress,
                                       int informationProviderPort,
                                       Information informationOfInterest,
                                       byte[] data)
                                throws InformationRetrieveException
Generic method to receive some Information from a specified ExternalInformationPort component, sending the bypassed data.

If communication channel isn't safe, but transmitted data is sensitive, cryptographic measures (like authentication and encryption) should be applied.

Specified by:
getInformation in interface ExternalInformationPortInterface
Parameters:
informationProviderAddress - Address of the ExternalInformationPort component to receive data from.
informationProviderPort - Port the ExternalInformationPort component to receive data from runs on.
informationOfInterest - Type of Information, that shall be received.
data - Data to be transmitted.
Returns:
The requested Information .
Throws:
InformationRetrieveException - Thrown, when requested Information not available.

getInformationFromAll

public java.lang.Object[] getInformationFromAll(java.net.InetAddress informationProviderAddress,
                                                int informationProviderPort,
                                                Information informationOfInterest)
                                         throws InformationRetrieveException
Generic method to receive some Information from several ExternalInformationPort components. The first component's address and port number must be specified. The other components addresses are received by their predecessor (= telescope implementation).

If communication channel isn't safe, but transmitted data is sensitive, cryptographic measures (like authentication and encryption) should be applied.

Specified by:
getInformationFromAll in interface ExternalInformationPortInterface
Parameters:
informationProviderAddress - Address of the InformationProvider -component to receive data from.
informationProviderPort - Port the InformationProvider -component to receive data from runs on.
informationOfInterest - Type of Information, that shall be received.
Returns:
The requested Information s.
Throws:
InformationRetrieveException - Thrown, when requested Information not available.

getInformationFromAll

public java.lang.Object[] getInformationFromAll(java.net.InetAddress informationProviderAddress,
                                                int informationProviderPort,
                                                Information informationOfInterest,
                                                byte[] data)
                                         throws InformationRetrieveException
Generic method to receive some Information from several ExternalInformationPort components, sending the bypassed data. The first component's address and port number must be specified. The other components' addresses are received by their predecessor (= telescope implementation).

If communication channel isn't safe, but transmitted data is sensitive, cryptographic measures (like authentication and encryption) should be applied.

Specified by:
getInformationFromAll in interface ExternalInformationPortInterface
Parameters:
informationProviderAddress - Address of the InformationProvider component to receive data from.
informationProviderPort - Port the InformationProvider component to receive data from runs on.
informationOfInterest - Type of Information, that shall be received.
data - Data to be transmitted.
Returns:
The requested Information s.
Throws:
InformationRetrieveException - Thrown, when requested Information not available.

acceptRequests

public void acceptRequests()
Make component start listening for requests (on communication channel).

Specified by:
acceptRequests in interface ExternalInformationPortInterface

getInterMixKey

private javax.crypto.SecretKey getInterMixKey(java.net.InetAddress nexMixInformationProviderAddress,
                                              int nexMixInformationProviderPort)
                                       throws InformationRetrieveException
Retrieves the specified's mix SYMMETRIC_KEY.

Parameters:
nexMixInformationProviderAddress - Address of the next mix' ExternalInformationPort component.
nexMixInformationProviderPort - Port the ExternalInformationPort component to receive data from runs on.
Returns:
The specified mix' SYMMETRIC_KEY.
Throws:
InformationRetrieveException - Thrown, when requested Information not available.

getInterMixIV

private javax.crypto.spec.IvParameterSpec getInterMixIV(java.net.InetAddress nexMixInformationProviderAddress,
                                                        int nexMixInformationProviderPort)
                                                 throws InformationRetrieveException
Retrieves the specified mix' IV.

Parameters:
nexMixInformationProviderAddress - Address of the next mix' ExternalInformationPort component.
nexMixInformationProviderPort - Port the ExternalInformationPort component to receive data from runs on.
Returns:
The specified mix' IV.
Throws:
InformationRetrieveException - Thrown, when requested Information not available.

getNextMixAddress

private java.net.InetAddress getNextMixAddress(java.net.InetAddress informationProviderAddress,
                                               int informationProviderPort)
                                        throws InformationRetrieveException
Retrieves the specified mix' NEXT_MIX_ADDRESS.

Parameters:
informationProviderAddress - Address of the next mix' ExternalInformationPort component.
informationProviderPort - Port the ExternalInformationPort component to receive data from runs on.
Returns:
The specified mix' NEXT_MIX_ADDRESS.
Throws:
InformationRetrieveException - Thrown, when requested Information not available.

getNextMixInfoPort

private int getNextMixInfoPort(java.net.InetAddress informationProviderAddress,
                               int informationProviderPort)
                        throws InformationRetrieveException
Retrieves the specified mix' NEXT_MIX_INFO_PORT.

Parameters:
informationProviderAddress - Address of the next mix' ExternalInformationProvider component (to receive data from).
informationProviderPort - Port the ExternalInformationProvider component (to receive data from) runs on.
Returns:
The specified mix' NEXT_MIX_INFO_PORT.
Throws:
InformationRetrieveException - Thrown, when requested Information not available.

getPublicKey

private java.security.PublicKey getPublicKey(java.net.InetAddress informationProviderAddress,
                                             int informationProviderPort)
                                      throws InformationRetrieveException
Retrieves the specified mix' PUBLIC_KEY.

Parameters:
informationProviderAddress - Address of the next mix' ExternalInformationProvider component (to receive data from).
informationProviderPort - Port the ExternalInformationProvider component (to receive data from) runs on.
Returns:
The specified mix' PUBLIC_KEY.
Throws:
InformationRetrieveException - Thrown, when requested Information not available.

getPublicKeys

private java.security.PublicKey[] getPublicKeys(java.net.InetAddress informationProviderAddress,
                                                int informationProviderPort)
                                         throws InformationRetrieveException
Retrieves the PUBLIC_KEYs of all mixes in the specified cascade.

Parameters:
informationProviderAddress - Address of the next mix' ExternalInformationProvider component (to receive data from).
informationProviderPort - Port the ExternalInformationProvider component (to receive data from) runs on.
Returns:
The PUBLIC_KEYs of all mixes in the specified cascade.
Throws:
InformationRetrieveException - Thrown, when requested Information not available.