org.openuat.util
Class Pair

java.lang.Object
  extended by org.openuat.util.Pair
All Implemented Interfaces:
java.lang.Runnable, ifListener, ifPair

public class Pair
extends java.lang.Object
implements ifPair

Author:
Lukas Wallentin Must be run as a thread!!! Example: comm = new Comm(); Thread commThread = new Thread(comm); commThread.start(); This Class provides basic key management functions. In the background it uses the Stored keys to generate additional keys between its two hop neighbors.

Constructor Summary
Pair()
          Standard Constructor
 
Method Summary
 byte[] getKey(java.lang.String _bob)
          Returns a single key or null if there is no key with that pair
 java.lang.String getLog()
          returns a string with debugging information
 void handleStringEvent(java.lang.String _data, boolean _success)
          Eventhandler called after the successfull sending of a message or if a message was received.
 void init(java.lang.String _remote)
          Init function to trigger two hop neighbour key keneration mechanism
 java.util.Hashtable listKeys()
          Returns Hashtable with keys
 void resetLog()
          resets the Log
 void run()
           
 void setKeyPair(java.lang.String _remote, byte[] _key)
          Set Key function
 void setName(java.lang.String _name)
          sets The name of the current device, must be done at the beginning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pair

public Pair()
Standard Constructor

Method Detail

init

public void init(java.lang.String _remote)
Init function to trigger two hop neighbour key keneration mechanism

Parameters:
_remote - name of he neighbour

getLog

public java.lang.String getLog()
Description copied from interface: ifPair
returns a string with debugging information

Specified by:
getLog in interface ifPair
Returns:
String with debugging infomation
See Also:
ifPair.getLog()

getKey

public byte[] getKey(java.lang.String _bob)
Description copied from interface: ifPair
Returns a single key or null if there is no key with that pair

Specified by:
getKey in interface ifPair
Parameters:
_bob - Name of the pair device
See Also:
ifPair.getKey(java.lang.String)

listKeys

public java.util.Hashtable listKeys()
Description copied from interface: ifPair
Returns Hashtable with keys

Specified by:
listKeys in interface ifPair
See Also:
ifPair.listKeys()

setKeyPair

public void setKeyPair(java.lang.String _remote,
                       byte[] _key)
Description copied from interface: ifPair
Set Key function

Specified by:
setKeyPair in interface ifPair
Parameters:
_remote - Name of the pair device
_key - shared key between the current and the pair device
See Also:
ifPair.setKeyPair(java.lang.String, byte[])

setName

public void setName(java.lang.String _name)
Description copied from interface: ifPair
sets The name of the current device, must be done at the beginning

Specified by:
setName in interface ifPair
Parameters:
_name - Name of the current device
See Also:
ifPair.setName(java.lang.String)

handleStringEvent

public void handleStringEvent(java.lang.String _data,
                              boolean _success)
Eventhandler called after the successfull sending of a message or if a message was received. If there is a new message, the message is stored in the vector for later usage

Specified by:
handleStringEvent in interface ifListener
Parameters:
_data - received data
_success - tells if there was success or not
See Also:
ifListener.handleStringEvent(java.lang.String, boolean)

run

public void run()
Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

resetLog

public void resetLog()
Description copied from interface: ifPair
resets the Log

Specified by:
resetLog in interface ifPair
See Also:
ifPair.resetLog()


2005-2009, Rene Mayrhofer.