|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.mac.MacHandler | +--ostore.mac.HMACDHHandler
MacHandler that uses HMAC for the message authentication and
Diffie-Hellman Key Generation.
Station-To-Station Protocol Implentation:
Basic Protocol:
There are four states: (1)UNINITIALIZED, (2)WAITFORRESPONSE, (3)WAITFORFINAL,
(4)ESTABLISHED.
There are three messages (across the network): (1)INITIALIZE, (2)RESPOND,
(3)FINALIZE.
There are three events (internal): (1)INIT (request to send out message 1),
(2) STS_TIMEOUT, (3)DH_TIMEOUT
State table
State | Event | Next Stage | Action |
UNINIT | DD sends (1)INIT event | WAITFORRESPONSE | Send message (1) |
UNINIT | Receive message (1) | WAITFORFINAL | Compute secret, Send message (2) |
WAITFORRESPONSE | Receive message (2) | ESTABLISHED | Confirm signature and Compute secret, Send message (3) |
WAITFORRESPONSE | Receive message (1) | WAITFORRESPONSE or WAITFORFINAL | If my guid is greater that their guid, I become WAITFORFINAL, else ignore message. |
WAITFORFINAL | Receive message (3) | ESTABLISHED | Confirm signature |
Nested Class Summary | |
---|---|
static class |
HMACDHHandler.MacBuffer
|
protected class |
HMACDHHandler.TellDhTimeout
|
protected class |
HMACDHHandler.TellInit
|
protected class |
HMACDHHandler.TellStsTimeout
|
Nested classes inherited from class ostore.mac.MacHandler |
---|
MacHandler.GuidNotEstablished, MacHandler.HandshakeFailed, MacHandler.KeyEstablished |
Field Summary | |
---|---|
protected Classifier |
_classifier
|
protected int |
_dhlifespan
|
protected Mac |
_hmac
|
protected KeyAgreement |
_kagree
|
protected static int |
_keysize
|
protected KeyPairGenerator |
_kpgen
|
protected SecureHash |
_myGuid
|
protected String |
_pkeyfile
|
protected SecureRandom |
_r
|
protected int |
_retryLimit
|
protected boolean |
_selfTest
|
protected Signature |
_signEngine
|
protected QSPrivateKey |
_sigPri
|
protected QSPublicKey |
_sigPub
|
protected String |
_skeyfile
|
protected int |
_stsTime
|
protected SinkIF |
_this_sink
|
static boolean |
ANNOUNCE
|
static boolean |
DEBUG
|
protected Hashtable |
establishedParties
|
protected static Hashtable |
instances
|
protected long |
MACTYPE_HMACMD5
|
protected Hashtable |
pendingParties
|
static boolean |
SEAN_DEBUG
|
static String |
tag
|
Constructor Summary | |
---|---|
HMACDHHandler()
|
Method Summary | |
---|---|
boolean |
authenticate(QuickSerializable user_data,
QSByteArray incoming_mac,
SecureHash guid)
Note: a failure may mean that a message was sent right before the sender decided to change keys that that message arrived after a new key was established (though this is unlikely) it is a possibility that needs to be accounted for. |
protected static void |
BUG(String msg)
|
protected boolean |
checkDHVerify(QuickSerializable user_data,
QSByteArray mac,
DHMessage dhmsg,
PartyInfo info)
|
void |
destroy()
|
protected void |
dispatch(QueueElementIF item)
|
QSByteArray |
doMAC(QuickSerializable user_data,
SecureHash guid)
Computes the MAC code for the this message |
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. |
static HMACDHHandler |
getInstance(SecureHash guid)
Return the HMACDHHandler associated with a particular guid. |
void |
handle_dh_message(DHMessage dhmsg)
Need these to happen before processing subsequent messages, so we call it from the Router directly now. |
protected void |
handle_dh_timeout(HMACDHHandler.TellDhTimeout tell)
|
protected void |
handle_init(HMACDHHandler.TellInit tell)
|
protected void |
handle_state_uninit(DHMessage dhmsg,
int msgType,
SecureHash otherguid,
PartyInfo info)
|
protected void |
handle_state_waitforfin(DHMessage dhmsg,
int msgType,
SecureHash otherguid,
PartyInfo info)
|
protected void |
handle_state_waitforresp_init(DHMessage dhmsg,
SecureHash otherguid,
PartyInfo info)
|
protected void |
handle_state_waitforresp_resp(DHMessage dhmsg,
SecureHash otherguid,
PartyInfo info)
|
protected void |
handle_sts_timeout(HMACDHHandler.TellStsTimeout tell)
|
void |
handleEvent(QueueElementIF item)
|
void |
handleEvents(QueueElementIF[] item)
|
String |
idString()
Id String |
void |
init(ConfigDataIF config)
|
protected void |
makeDHVerify(QSDHPublicKey myPu,
QSDHPublicKey otherPu,
SecretKey macSecret,
DHMessage destination)
|
protected void |
makeNewDHKeys(PartyInfo info)
|
SecureHash |
myGuid()
My GUID |
int |
profileSize()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String tag
public static final boolean SEAN_DEBUG
public static final boolean DEBUG
public static final boolean ANNOUNCE
protected static final int _keysize
protected static Hashtable instances
protected Hashtable establishedParties
protected Hashtable pendingParties
protected KeyPairGenerator _kpgen
protected KeyAgreement _kagree
protected SecureRandom _r
protected Signature _signEngine
protected String _pkeyfile
protected String _skeyfile
protected QSPublicKey _sigPub
protected QSPrivateKey _sigPri
protected Mac _hmac
protected SecureHash _myGuid
protected SinkIF _this_sink
protected int _stsTime
protected int _retryLimit
protected int _dhlifespan
protected boolean _selfTest
protected Classifier _classifier
protected long MACTYPE_HMACMD5
Constructor Detail |
public HMACDHHandler()
Method Detail |
protected void handle_init(HMACDHHandler.TellInit tell)
protected void handle_sts_timeout(HMACDHHandler.TellStsTimeout tell)
protected void handle_dh_timeout(HMACDHHandler.TellDhTimeout tell)
protected void handle_state_uninit(DHMessage dhmsg, int msgType, SecureHash otherguid, PartyInfo info)
protected void handle_state_waitforresp_resp(DHMessage dhmsg, SecureHash otherguid, PartyInfo info)
protected void handle_state_waitforresp_init(DHMessage dhmsg, SecureHash otherguid, PartyInfo info)
protected void handle_state_waitforfin(DHMessage dhmsg, int msgType, SecureHash otherguid, PartyInfo info)
public void handle_dh_message(DHMessage dhmsg)
MacHandler
handle_dh_message
in class MacHandler
public void handleEvent(QueueElementIF item) throws EventHandlerException
handleEvent
in interface EventHandlerIF
handleEvent
in class MacHandler
EventHandlerException
public void handleEvents(QueueElementIF[] item) throws EventHandlerException
handleEvents
in interface EventHandlerIF
handleEvents
in class MacHandler
EventHandlerException
protected boolean checkDHVerify(QuickSerializable user_data, QSByteArray mac, DHMessage dhmsg, PartyInfo info) throws InvalidKeyException, SignatureException, TypeTable.NoSuchTypeCode
InvalidKeyException
SignatureException
TypeTable.NoSuchTypeCode
protected void makeDHVerify(QSDHPublicKey myPu, QSDHPublicKey otherPu, SecretKey macSecret, DHMessage destination) throws SignatureException, InvalidKeyException
SignatureException
InvalidKeyException
protected void makeNewDHKeys(PartyInfo info)
public void init(ConfigDataIF config) throws Exception
init
in interface EventHandlerIF
init
in class MacHandler
Exception
public static HMACDHHandler getInstance(SecureHash guid)
public void establish(SecureHash guid)
MacHandler.KeyEstablished
announcement.
establish
in class MacHandler
public boolean authenticate(QuickSerializable user_data, QSByteArray incoming_mac, SecureHash guid) throws MacHandler.GuidNotEstablished
authenticate
in class MacHandler
true
iff this message is authentic, i.e.
verified by the internal MAC
MacHandler.GuidNotEstablished
public QSByteArray doMAC(QuickSerializable user_data, SecureHash guid) throws MacHandler.GuidNotEstablished
true
iff the MAC was computed successfully.
MacHandler.GuidNotEstablished
public String idString()
MacHandler
idString
in class MacHandler
public SecureHash myGuid()
MacHandler
myGuid
in class MacHandler
public void destroy() throws Exception
destroy
in interface EventHandlerIF
destroy
in class MacHandler
Exception
public int profileSize()
profileSize
in interface ProfilableIF
profileSize
in class MacHandler
protected static final void BUG(String msg)
protected void dispatch(QueueElementIF item)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |