|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--hypercast.NotificationHandler | +--hypercast.SecurityProcessor
This class defines the functions for handling the sending/receiving of secure messages. Once the instance of this class is created, it works as the node adapter for an overlay node and builds a bridge between the overlay node and the normal node adapter. The relationship between the overlay node, security processor and normal node adapter are represented by the following two chains: (I_AdapterCallBack object) node <- ((I_AdapterCallBack object) this object <- (I_UnicastAdapter) adapter node -> (I_UnicastAdapter) this object -> (I_AdapterCallBack object) adapter
Field Summary |
Fields inherited from interface hypercast.I_IPv4_UnicastAdapter |
MAX_RETRIES_TO_OPEN_SOCKET |
Fields inherited from interface hypercast.I_UnicastAdapter |
CLOSED, STARTED, STARTING, STOPPED, STOPPING |
Constructor Summary | |
SecurityProcessor(hypercast.HyperCastConfig c,
hypercast.KeyVault keyvault,
hypercast.I_UnicastAdapter _adapter)
Constructor. |
Method Summary | |
void |
clearSecurityTimer(java.lang.Object timer_id)
Clear a SecurityTimer event |
void |
clearTimer(java.lang.Object timer_id)
Clear a Timer event |
void |
close()
pass the close call down to the adapter. |
hypercast.I_AddressPair |
createAddressPair(hypercast.I_PhysicalAddress pa,
hypercast.I_LogicalAddress la)
Create an address pair from a physical address and a logical address. |
hypercast.I_PhysicalAddress |
createPhysicalAddress()
Creates a new physical address. |
hypercast.I_PhysicalAddress |
createPhysicalAddress(byte[] byteaddr,
int offset)
Creates physical address from a byte array. |
hypercast.I_PhysicalAddress |
createPhysicalAddress(java.lang.String addrString)
Creates physical address from a string. |
hypercast.I_UnderlayAddress |
createUnderlayAddress()
Creates a new underlay address. |
hypercast.I_UnderlayAddress |
createUnderlayAddress(byte[] byteAddressAndPort,
int offset)
Creates underlay address from a byte array of address - the inverse of toByteArray. |
hypercast.I_UnderlayAddress |
createUnderlayAddress(java.lang.String addrString)
Creates underlay address object from a string. |
hypercast.I_UnicastAdapter |
getAdapter()
|
hypercast.I_AdapterCallback |
getCallBack()
|
long |
getCurrentTime()
Gets the current time. |
java.lang.Object |
getInfo()
Get information of the adapter. |
hypercast.KeyVault |
getKeyVault()
Gets the key vault object kept by this object. |
hypercast.I_PhysicalAddress |
getMulticastAddress()
Gets the multicast address of the adapter. |
javax.crypto.spec.SecretKeySpec |
getMyKeyFor(hypercast.I_AddressPair dst_ap,
hypercast.I_AddressPair src_ap)
The function return the key that the local node is exchanging with a remote destination node. |
long |
getMyKeyTimestampFor(hypercast.I_AddressPair dst_ap,
hypercast.I_AddressPair src_ap)
|
hypercast.I_Node |
getNode()
|
int |
getPhysicalAddressSize()
Returns the size of physical address, when carried in a packet, recognized by this adapter. |
org.w3c.dom.Element[] |
getReadSchema(org.w3c.dom.Document doc,
org.apache.xpath.XPath xpath)
Return the schema element which represents the root of the sub-tree, specified by the given xpath, in read schema tree. |
long |
getSecurityTimer(java.lang.Object timer_id)
Get a SecurityTimer event |
org.w3c.dom.Element[] |
getStats(org.w3c.dom.Document doc,
org.apache.xpath.XPath xpath)
Return the result of query for the statistics specified by the given xpath. |
java.lang.String |
getStatsName()
Gets the element name of the adapter. |
long |
getTimer(java.lang.Object timer_id)
Get a Timer event |
int |
getUnderlayAddressSize()
Returns the size of underlay address, when carried in a packet, recognized by this adapter. |
java.lang.String |
getVersion()
|
org.w3c.dom.Element[] |
getWriteSchema(org.w3c.dom.Document doc,
org.apache.xpath.XPath xpath)
Return the schema element which represents the root of the sub-tree, specified by the given xpath, in write schema tree. |
void |
handle_NODE_NEIGHBORHOODCHANGED(hypercast.events.NODE_NEIGHBORHOODCHANGED event)
Handle neighborhood change event. |
void |
initiateAuthentication(hypercast.I_AddressPair src)
Initialize certificate exchange process with given node. |
void |
messageArrivedFromAdapter(hypercast.I_Message a)
Checks all incoming protocol messages for security extensions and performs appropriate integrity checks and/or decryption before handing the message to the node to process. |
void |
requestKeyFor(hypercast.I_LogicalAddress nodeLA)
Initiate a key exchange with a node |
boolean |
Reset(java.lang.Object socketObj)
Reset the sockets in the adapter. |
hypercast.I_Message |
restoreMessage(byte[] receiveBuffer,
int[] validBytesStart,
int validBytesEnd)
Restore an SecInfoExchange_Message from byte array. |
void |
sendMulticastMessage(hypercast.I_Message msg)
Sends out a multicast message. |
void |
sendUnicastMessage(hypercast.I_NetworkAddress dst,
hypercast.I_Message msg)
Sends out an unicast message. |
void |
setAdapter(hypercast.I_UnicastAdapter adapter)
Sets the adapter stored in the instance of this class. |
void |
setCallback(hypercast.I_AdapterCallback adaptercallbackObj)
Set the adapter callback object. |
void |
setLastSecureMessageTime(hypercast.I_LogicalAddress nodeLA)
Set the time when the last secure message was received from the given node. |
void |
setNode(hypercast.I_Node node)
Sets the overlay node stored in the instance of this class. |
void |
setSecurityTimer(java.lang.Object timer_id,
long delay_ms)
Set a SecurityTimer event |
org.w3c.dom.Element[] |
setStats(org.w3c.dom.Document doc,
org.apache.xpath.XPath xpath,
org.w3c.dom.Element newValue)
Set the statistics specified by the given xpath. |
void |
setStatsName(java.lang.String name)
Sets the element name of the adapter. |
void |
setTimer(java.lang.Object timer_id,
long delay_ms)
Set a Timer event. |
void |
Start()
Starts the adapter. |
void |
Stop()
Stops the adapter. |
void |
Stop(long delay)
Stops all the threads in the UnicastAdapter after a delay When stop returns, the adapter is stopped. |
void |
timerExpired(java.lang.Object Timer_Object)
This function, a member of I_AdapterCallBack, is called for the WatchDogTimer timer and DelayNewKeyTimer. |
void |
updatePersonalKey(java.security.PrivateKey pKey)
Update my private or personal key. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SecurityProcessor(hypercast.HyperCastConfig c, hypercast.KeyVault keyvault, hypercast.I_UnicastAdapter _adapter)
c
- overlay socket configuration object.keyvault
- a KeyVault instance._adapter
- node adapter.Method Detail |
public hypercast.KeyVault getKeyVault()
public java.lang.String getVersion()
public hypercast.I_AddressPair createAddressPair(hypercast.I_PhysicalAddress pa, hypercast.I_LogicalAddress la)
public void messageArrivedFromAdapter(hypercast.I_Message a)
messageArrivedFromAdapter
in interface I_AdapterCallback
a
- a message to be processed.
java.lang.IllegalArgumentException
- if the given message is not an instance of
SecInfoExchange_Message.public void initiateAuthentication(hypercast.I_AddressPair src)
src
- the logical address of the node with witch certificate
is exchanged.public void updatePersonalKey(java.security.PrivateKey pKey)
pKey
- a private key.public hypercast.I_Message restoreMessage(byte[] receiveBuffer, int[] validBytesStart, int validBytesEnd)
restoreMessage
in interface I_AdapterCallback
receiveBuffer
- the byte array buffer which contains the packetvalidBytesStart
- start position of valid section of the arrayvalidBytesEnd
- end of valid section of the array (actually, 1 beyond last valid byte.)
I_AdapterCallback.restoreMessage(byte[], int[], int)
public void requestKeyFor(hypercast.I_LogicalAddress nodeLA)
nodeLA
- the logical address of the node with which
the key is exchanged.public void setLastSecureMessageTime(hypercast.I_LogicalAddress nodeLA)
nodeLA
- the logical address of the node from which the secure message
is received.public hypercast.I_UnicastAdapter getAdapter()
public hypercast.I_Node getNode()
public void setAdapter(hypercast.I_UnicastAdapter adapter)
adapter
- an I_UnicastAdapter object.public void setNode(hypercast.I_Node node)
node
- an I_Node object.public hypercast.I_AdapterCallback getCallBack()
public void timerExpired(java.lang.Object Timer_Object)
timerExpired
in interface I_AdapterCallback
Timer_Object
- index of the timer that has expiredpublic void Start()
Start
in interface I_UnicastAdapter
I_UnicastAdapter.Start()
public void Stop()
Stop
in interface I_UnicastAdapter
I_UnicastAdapter.Stop()
public void Stop(long delay)
I_UnicastAdapter
Stop
in interface I_UnicastAdapter
delay
- delay in millisecondspublic void close()
close
in interface I_UnicastAdapter
public void sendUnicastMessage(hypercast.I_NetworkAddress dst, hypercast.I_Message msg)
sendUnicastMessage
in interface I_UnicastAdapter
dst
- the physical or underlay address of the destination of this message.msg
- plaintext protocol message to be sent out.(hypercast.I_PhysicalAddress, hypercast.I_Message)
public void sendMulticastMessage(hypercast.I_Message msg)
sendMulticastMessage
in interface I_MulticastAdapter
I_MulticastAdapter.sendMulticastMessage(hypercast.I_Message)
public hypercast.I_PhysicalAddress createPhysicalAddress(byte[] byteaddr, int offset)
createPhysicalAddress
in interface I_UnicastAdapter
byteaddr
- an byte array containing a physical address.offset
- the position in byteAddr from where availabe
data is read.
I_PhysicalAddress
.I_UnicastAdapter.createPhysicalAddress(byte[], int)
public hypercast.I_PhysicalAddress createPhysicalAddress(java.lang.String addrString)
createPhysicalAddress
in interface I_UnicastAdapter
addrString
- an string representing a physical address.
I_PhysicalAddress
.I_UnicastAdapter.createPhysicalAddress(java.lang.String)
public hypercast.I_PhysicalAddress createPhysicalAddress()
createPhysicalAddress
in interface I_UnicastAdapter
I_PhysicalAddress
.I_UnicastAdapter.createPhysicalAddress()
public int getPhysicalAddressSize()
getPhysicalAddressSize
in interface I_UnicastAdapter
public hypercast.I_UnderlayAddress createUnderlayAddress(byte[] byteAddressAndPort, int offset)
toByteArray. The first 4 bytes reprsent the IP address,
and the last 4 bytes represent the port number.
- Specified by:
createUnderlayAddress
in interface I_UnicastAdapter
- Parameters:
byteAddressAndPort
- an byte array containing a physical addressoffset
- the position in byteAddressAndPort from where availabe
data is read.
- Returns:
- a new instance of
I_UnderlayAddress
- See Also:
INETv4OnePort.toByteArray()
public hypercast.I_UnderlayAddress createUnderlayAddress(java.lang.String addrString)
createUnderlayAddress
in interface I_UnicastAdapter
addrString
- an string representing a physical address.
I_UnderlayAddress
.public hypercast.I_UnderlayAddress createUnderlayAddress()
createUnderlayAddress
in interface I_UnicastAdapter
I_UnderlayAddress
.public int getUnderlayAddressSize()
getUnderlayAddressSize
in interface I_UnicastAdapter
public boolean Reset(java.lang.Object socketObj)
Reset
in interface I_UnicastAdapter
socketObj
- object passed to do reset.I_UnicastAdapter.Reset(java.lang.Object)
public java.lang.Object getInfo()
getInfo
in interface I_UnicastAdapter
I_UnicastAdapter.getInfo()
public void setCallback(hypercast.I_AdapterCallback adaptercallbackObj)
setCallback
in interface I_UnicastAdapter
I_UnicastAdapter.setCallback(I_AdapterCallback)
public javax.crypto.spec.SecretKeySpec getMyKeyFor(hypercast.I_AddressPair dst_ap, hypercast.I_AddressPair src_ap)
dst_ap
- the address of the remote nodesrc_ap
- the address of the current node
public long getMyKeyTimestampFor(hypercast.I_AddressPair dst_ap, hypercast.I_AddressPair src_ap)
return the key timestamp for the key that is return by getMyKeyFor() function
public void setTimer(java.lang.Object timer_id, long delay_ms)
Timer
event. . It calls the same method in the node adapter.
setTimer
in interface I_UnicastAdapter
timer_id
- a time event IDdelay_ms
- a time in mspublic void setSecurityTimer(java.lang.Object timer_id, long delay_ms)
SecurityTimer
event . It calls the same method in the node adapter.
timer_id
- a time event IDdelay_ms
- a time in mspublic void clearTimer(java.lang.Object timer_id)
Timer
event . It calls the same method in the node adapter.
clearTimer
in interface I_UnicastAdapter
timer_id
- a time event IDpublic void clearSecurityTimer(java.lang.Object timer_id)
SecurityTimer
event. It calls the same method in the node adapter.
timer_id
- a time event IDpublic long getTimer(java.lang.Object timer_id)
Timer
event . It calls the same method in the node adapter.
getTimer
in interface I_UnicastAdapter
timer_id
- a time event ID
public long getSecurityTimer(java.lang.Object timer_id)
SecurityTimer
event . It calls the same method in the node adapter.
timer_id
- a security time event ID
I_UnicastAdapter.getCurrentTime()
public long getCurrentTime()
getCurrentTime
in interface I_UnicastAdapter
I_UnicastAdapter.getCurrentTime()
public hypercast.I_PhysicalAddress getMulticastAddress()
getMulticastAddress
in interface I_MulticastAdapter
I_MulticastAdapter.getMulticastAddress()
public org.w3c.dom.Element[] getStats(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath) throws HyperCastStatsException
getStats
in interface I_Stats
doc
- Document used for create new elements or nodes.xpath
- XPath instance represents the statistics to be queried.
HyperCastStatsException
- If the xpath does not specify a valid subtree.I_Stats.getStats(org.w3c.dom.Document, org.apache.xpath.XPath)
public org.w3c.dom.Element[] setStats(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath, org.w3c.dom.Element newValue) throws HyperCastStatsException
setStats
in interface I_Stats
doc
- Document used for create new elements or nodes.xpath
- XPath instance represents the statistics to be queried.newValue
- Element representing the value or sub-tree to be set.
HyperCastStatsException
- If the xpath does not specify a
valid subtree or if any part of the the subtree is read-only,
or if the newValue
does not conform with the
expected format.I_Stats.setStats(org.w3c.dom.Document, org.apache.xpath.XPath, org.w3c.dom.Element)
public org.w3c.dom.Element[] getReadSchema(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath) throws HyperCastStatsException
getReadSchema
in interface I_Stats
doc
- Document used for create new elements or nodes.xpath
- XPath instance representing the statistics which is the root
of the sub-tree to be queried.
HyperCastStatsException
- If some part of the specified
subtree does not correctly implement this interface method.I_Stats.getReadSchema(Document, XPath)
public org.w3c.dom.Element[] getWriteSchema(org.w3c.dom.Document doc, org.apache.xpath.XPath xpath) throws HyperCastStatsException
getWriteSchema
in interface I_Stats
doc
- Document used for create new elements or nodes.xpath
- XPath instance representing the statistics which is the root
of the sub-tree to be queried.
HyperCastStatsException
- If some part of the specified
subtree does not correctly implement this interface method.I_Stats.getWriteSchema(Document, XPath)
public java.lang.String getStatsName()
getStatsName
in interface I_Stats
I_Stats.getStatsName()
public void setStatsName(java.lang.String name)
setStatsName
in interface I_Stats
name
- the statistics name to be set.I_Stats.setStatsName(String)
public void handle_NODE_NEIGHBORHOODCHANGED(hypercast.events.NODE_NEIGHBORHOODCHANGED event)
handle_NODE_NEIGHBORHOODCHANGED
in class NotificationHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |