## 3 The Security Mechanism
### Overall Detection  
Overall detection (OD) is a centralized algorithm. In this mechanism, the key materials of node \(u\) are legitimate as long as node \(u\) is within its own MSA which has \(\text{LOC}_{u}^{\text{T}u}\) as the center and a radius of \(\Delta_{u}\). The location-based key of node \(u\) is invalid when node \(u\) moves out of its own MSA. In this case, node \(u\) receives some requirements about updating keys from its neighbors and then applies for a new location-based key with the sink node. Specific updating-related processes are as follows. Firstly, node \(u\) broadcasts the request about updating its location-based key. The validity of node \(u\) is authenticated by at least \(t\) neighbors. These neighbors are called witness nodes. After that, \(t\) witness nodes will test whether \(|LOC_{u}-loc_{u}|\geq\Delta_{u}\) and \(\frac{|LOC_{u}-loc_{u}|}{|\tau_{u}-t_{u}|}\leq\
u_{max}\) are established or not. If the inequations are established, these witness nodes will sign the request messages by using their own location-based keys: \((\text{SIG}_{LR_{t}}\left(loc_{u}^{t_{u}}\parallel ID_{u}\right)\), \(\left(loc_{u}^{t_{u}}\parallel ID_{u}\parallel ID_{i}\parallel LOC_{t}^{T_{ i}}\parallel\Delta_{i}\right))\), and then send the messages to the sink node. In contrast, the alert messages will be sent to the network to tell other nodes that node \(u\) is a malicious node. Malicious nodes could not collude with each other to defraud a new legitimate location-based key unless these \(t\) witness nodes are all captured in the communication range of node \(u\) at the same time. The value of parameter \(t\) depends on the average number of node \(u\)'s neighbors. Here we set \(t=3\) to ensure higher probability of successfully updating keys. When the sink node receives t request messages marked with the same ID, it confirms the validity of \(t\) witness nodes by verifying whether the signed messages are legitimate. Next, the sink node further confirms the validity of node \(u\) by checking the continuity of node \(u\)'s movement path. The messages, which are composed of node ID, location information and current time of each node in network, are recorded in the sink node. Next, the sink node tests whether the inequations \(|LOC_{u}-loc_{u}|\geq\Delta_{u}\) and \(\frac{|LOC_{u}-loc_{u}|}{|\tau_{u}-t_{u}|}\leq\
u_{max}\) are established; here the value of parameter \(\Delta_{u}\) depends on the area security needs. If either of two inequations is not established, there are malicious witness nodes colluding to defraud the location-based keys. That is because the legitimate witness nodes should have tested these inequations and ensured that node \(u\) is a legitimate node. However, this is just an extreme case, and only happens when there are too many nodes captured by adversaries so that there is no legitimate node in some local areas. If both of the two inequations are established, the sink node will set \(LOC_{u}^{T_{u}}\gets loc_{u}^{t_{u}}\) and \(\Delta_{u}\leftarrow\Delta\). The updating key of node \(u\) will be encrypted with node \(u\)'s identity-based public key and signed by the sink node's identity-based private key \((\text{E}_{IK_{u}}(\text{SIG}_{IK_{SN}}\left(\text{LOC}_{u}^{\text{T}u} \parallel\Delta_{u}\right)\left(\text{LOC}_{u}^{\text{T}u}\parallel\Delta_{ u}\parallel\text{ID}_{SN}\right)))\). Here \(\text{E}_{IK_{u}}(\cdot)\) denotes that the message is encrypted with node \(u\)'s identity-based key, so a new location-based only could be decrypted by node \(u\) because only node \(u\) has the corresponding identity-based private key. There is a situation in which node \(u\) has moved out of its own MSA but could not be authenticated because the number of witness nodes is less than \(t\). The random deployment of network nodes can be modeled as a spatial homogeneous Poisson point process [14].