externalInformationPort
Class InformationProvider

java.lang.Object
  extended by java.lang.Thread
      extended by externalInformationPort.InformationProvider
All Implemented Interfaces:
java.lang.Runnable

final class InformationProvider
extends java.lang.Thread

Provides Information for "external" communication partners (e. g. other mixes or clients) vie network (UDP).

Author:
Karl-Peter Fuchs

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  java.net.DatagramSocket datagramSocket
          DatagramSocket this InformationProvider runs on.
private  byte[] encryptedInterMixKey
          Key used to encrypt data between this mix and its predecessor, encrypted with the predecessor's public key.
(package private)  java.util.EnumMap<Information,java.lang.Integer> enumMap
          Enumeration used to identify incoming requests.
private  ExternalInformationPortController externalInformationPort
          Reference on component ExternalInformationPort.
private  javax.crypto.spec.IvParameterSpec interMixIV
          Initialization vector used to encrypt data between this mix and its predecessor.
private  javax.crypto.SecretKey interMixKey
          Key used to encrypt data between this mix and its predecessor.
private static InternalInformationPortController internalInformationPort
          Reference on component InternalInformationPort.
private  boolean isSymmetricKeyEncrypted
          Indicates whether the key used to encrypt data between this mix and its predecessor has already been encrypted (= prepared for sending via an insecure channel).
private static java.util.logging.Logger LOGGER
          Logger used to log and display information.
private static int MAX_PACKET_SIZE
          Maximum size a request may have.
private  java.lang.String nextMixHostName
          Host name of the next mix in the cascade.
private  int nextMixInfoPort
          Port number of the next mix in the cascade.
private  int positionOfMixInCascade
          The mix' position in the cascade this object belongs to. "1" means "first mix", "2" means "a middle mix" and "3" means "last mix" of cascade (or single mix).
private  java.net.InetAddress previousMixAddress
          Address of the previous mix in the cascade.
private  int previousMixInfoPort
          Port number of the previous mix' InformationProvider component.
private  java.security.PublicKey publicKey
          This mix' public key.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
protected InformationProvider(java.security.PublicKey publicKey, ExternalInformationPortController eip)
          Creates a new InformationProvider that provides Information for "external" communication partners (e. g.
 
Method Summary
protected  void acceptRequests()
          Make this InformationProvider start listening for requests (on communication channel).
private  byte[] encryptInterMixKey()
          Encrypts and returns the interMixKey>/code>.
private  byte[] generateResponse(Information informationOfInterest, byte[] data)
          Generates a byte array containing the information specified by the bypassed value (= information, the caller is interested in).
private  byte[] provideInterMixIV()
          Provides this mix' INTER_MIX_IV.
private  byte[] provideInterMixKey()
          Provides this mix' INTER_MIX_KEY.
private  byte[] provideNextMixAddress()
          Provides this mix' NEXT_MIX_ADDRESS.
private  byte[] provideNextMixInfoPort()
          Provides this mix' NEXT_MIX_INFO_PORT.
private  byte[] providePublicKey()
          Provides this mix' PUBLIC_KEY.
 void run()
          Answers incoming requests.
protected  void setInterMixIVWithPreviousMix(javax.crypto.spec.IvParameterSpec interMixIV)
          Sets the initialization vector used to encrypt data between this mix and its predecessor.
protected  void setInterMixKeyWithPreviousMix(javax.crypto.SecretKey interMixKey)
          Sets the key used to encrypt data between this mix and its predecessor.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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.


MAX_PACKET_SIZE

private static final int MAX_PACKET_SIZE
Maximum size a request may have.

See Also:
Constant Field Values

externalInformationPort

private ExternalInformationPortController externalInformationPort
Reference on component ExternalInformationPort. Used to receive data from ExternalInformationPort components on different hosts.


datagramSocket

private java.net.DatagramSocket datagramSocket
DatagramSocket this InformationProvider runs on.


enumMap

java.util.EnumMap<Information,java.lang.Integer> enumMap
Enumeration used to identify incoming requests.

See Also:
Information

publicKey

private java.security.PublicKey publicKey
This mix' public key.


interMixKey

private javax.crypto.SecretKey interMixKey
Key used to encrypt data between this mix and its predecessor.


encryptedInterMixKey

private byte[] encryptedInterMixKey
Key used to encrypt data between this mix and its predecessor, encrypted with the predecessor's public key.


interMixIV

private javax.crypto.spec.IvParameterSpec interMixIV
Initialization vector used to encrypt data between this mix and its predecessor.


isSymmetricKeyEncrypted

private boolean isSymmetricKeyEncrypted
Indicates whether the key used to encrypt data between this mix and its predecessor has already been encrypted (= prepared for sending via an insecure channel).

See Also:
interMixKey, encryptedInterMixKey

positionOfMixInCascade

private int positionOfMixInCascade
The mix' position in the cascade this object belongs to. "1" means "first mix", "2" means "a middle mix" and "3" means "last mix" of cascade (or single mix).


nextMixHostName

private java.lang.String nextMixHostName
Host name of the next mix in the cascade.


nextMixInfoPort

private int nextMixInfoPort
Port number of the next mix in the cascade.


previousMixAddress

private java.net.InetAddress previousMixAddress
Address of the previous mix in the cascade.


previousMixInfoPort

private int previousMixInfoPort
Port number of the previous mix' InformationProvider component.

Constructor Detail

InformationProvider

protected InformationProvider(java.security.PublicKey publicKey,
                              ExternalInformationPortController eip)
Creates a new InformationProvider that provides Information for "external" communication partners (e. g. other mixes or clients) vie network (UDP).

Parameters:
publicKey - This mix' public key.
eip - Reference on component ExternalInformationPort. Used to reveive Information from communication partners.
Method Detail

setInterMixKeyWithPreviousMix

protected void setInterMixKeyWithPreviousMix(javax.crypto.SecretKey interMixKey)
Sets the key used to encrypt data between this mix and its predecessor.

Parameters:
interMixKey - Key used to encrypt data between this mix and its predecessor.

setInterMixIVWithPreviousMix

protected void setInterMixIVWithPreviousMix(javax.crypto.spec.IvParameterSpec interMixIV)
Sets the initialization vector used to encrypt data between this mix and its predecessor.

Parameters:
interMixIV - Initialization vector used to encrypt data between this mix and its predecessor.

acceptRequests

protected void acceptRequests()
Make this InformationProvider start listening for requests (on communication channel).


generateResponse

private byte[] generateResponse(Information informationOfInterest,
                                byte[] data)
Generates a byte array containing the information specified by the bypassed value (= information, the caller is interested in).

Parameters:
informationOfInterest - Information, the caller is interested in.
data - Data submitted by caller.
Returns:
Byte array containing the information specified by the bypassed value (= information, the caller is interested in) or null if the requested information is not available.

providePublicKey

private byte[] providePublicKey()
Provides this mix' PUBLIC_KEY.

Security note: Key is not signed!

Returns:
This mix' PUBLIC_KEY.

provideInterMixKey

private byte[] provideInterMixKey()
Provides this mix' INTER_MIX_KEY.

Security note: Key is not signed!

Returns:
This mix' INTER_MIX_KEY.

provideInterMixIV

private byte[] provideInterMixIV()
Provides this mix' INTER_MIX_IV.

Security note: Not signed!

Returns:
This mix' INTER_MIX_IV.

provideNextMixAddress

private byte[] provideNextMixAddress()
Provides this mix' NEXT_MIX_ADDRESS.

Security note: Not signed!

Returns:
This mix' NEXT_MIX_ADDRESS.

provideNextMixInfoPort

private byte[] provideNextMixInfoPort()
Provides this mix' NEXT_MIX_INFO_PORT.

Security note: Not signed!

Returns:
This mix' NEXT_MIX_INFO_PORT.

encryptInterMixKey

private byte[] encryptInterMixKey()
Encrypts and returns the interMixKey>/code>.

Returns:
The encrypted interMixKey>/code>.
See Also:
interMixKey, isSymmetricKeyEncrypted

run

public void run()
Answers incoming requests.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread