ostore.mac
Class MacHandler

java.lang.Object
  |
  +--ostore.mac.MacHandler
All Implemented Interfaces:
EventHandlerIF, ProfilableIF, SingleThreadedEventHandlerIF
Direct Known Subclasses:
HMACDHHandler

public abstract class MacHandler
extends Object
implements SingleThreadedEventHandlerIF, EventHandlerIF, ProfilableIF

MacHandler. Responsible for checking message authenticity and initializing 'first contact' with another OceanStore instance. The result being

(1) a MAC relationship established between both parties,

(2) a GUID exchange, and

(3) the source of your machine's GUID.

Additional details are implementation specific.

Note:There is to be only one MacHandler per instance of sandstorm.


Nested Class Summary
 class MacHandler.GuidNotEstablished
          Thrown when a request for action (such as authenticate(ostore.util.QuickSerializable, ostore.util.QSByteArray, ostore.util.SecureHash) or is called on a guid that doesn't have an established connection yet.
 class MacHandler.HandshakeFailed
          Announcement that after multiple retries, we were still unable to successfully establish a connection with the guid.
 class MacHandler.KeyEstablished
          Announcement that we have established a connection with the guid and are ready to call authenticate(ostore.util.QuickSerializable, ostore.util.QSByteArray, ostore.util.SecureHash) on that guid.
 
Field Summary
static boolean DEBUG
           
 
Constructor Summary
MacHandler()
           
 
Method Summary
abstract  boolean authenticate(QuickSerializable user_data, QSByteArray mac, SecureHash guid)
           
abstract  void destroy()
           
abstract  void establish(SecureHash guid)
          Establish a connection between the guid and this instance of sandstorm

Once a connection is established, the MacHandler will broadcast a MacHandler.KeyEstablished announcement.
abstract  void handle_dh_message(DHMessage dhmsg)
          Need these to happen before processing subsequent messages, so we call it from the Router directly now.
abstract  void handleEvent(QueueElementIF item)
           
 void handleEvents(QueueElementIF[] item)
           
abstract  String idString()
          Id String
abstract  void init(ConfigDataIF config)
           
abstract  SecureHash myGuid()
          My GUID
abstract  int profileSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
See Also:
Constant Field Values
Constructor Detail

MacHandler

public MacHandler()
Method Detail

handleEvent

public abstract void handleEvent(QueueElementIF item)
                          throws EventHandlerException
Specified by:
handleEvent in interface EventHandlerIF
EventHandlerException

handleEvents

public void handleEvents(QueueElementIF[] item)
                  throws EventHandlerException
Specified by:
handleEvents in interface EventHandlerIF
EventHandlerException

handle_dh_message

public abstract void handle_dh_message(DHMessage dhmsg)
Need these to happen before processing subsequent messages, so we call it from the Router directly now.


idString

public abstract String idString()
Id String


myGuid

public abstract SecureHash myGuid()
My GUID


establish

public abstract void establish(SecureHash guid)
Establish a connection between the guid and this instance of sandstorm

Once a connection is established, the MacHandler will broadcast a MacHandler.KeyEstablished announcement. If a connection is pending this will be ignored. If a connection to this guid is already established, a MacHandler.KeyEstablished will be broadcasted.


authenticate

public abstract boolean authenticate(QuickSerializable user_data,
                                     QSByteArray mac,
                                     SecureHash guid)
                              throws MacHandler.GuidNotEstablished
Returns:
true iff this message is authentic, i.e. verified by the internal MAC
MacHandler.GuidNotEstablished

init

public abstract void init(ConfigDataIF config)
                   throws Exception
Specified by:
init in interface EventHandlerIF
Exception

destroy

public abstract void destroy()
                      throws Exception
Specified by:
destroy in interface EventHandlerIF
Exception

profileSize

public abstract int profileSize()
Specified by:
profileSize in interface ProfilableIF