## 5 Light-Weight Distributed Security Scheme
### Key Management  
Our security scheme uses symmetric keys to encrypt and authenticate messages. Therefore, sensor nodes will only receive messages from other nodes that share the same security keys. The key management is composed of two phases: a key generation phase and a key distribution phase. In the _key generation_ phase, a Master key (K\({}_{m}\)) is installed in the sensor motes when they are programmed with the intended software. The _key distribution_ phase provides a means for distributing or synchronization of the security keys (unique-node key, pair-wise key, and unique-cluster key) among the nodes. The key management protocol satisfies the following security properties of a key establishment:  
* The shared security keys between a node and the neighboring nodes and/or BS cannot be used to recover the master key. This is guaranteed because of the one-wayness of a secure hash function.
* The master key (K\({}_{m}\)) is kept by the nodes as long as it is necessary to establish security keys with their neighbors, and then it is deleted from their memory. The base station holds K\({}_{m}\) along with the unique-node keys of each sensor node in the network.  
(1) The **unique-node key** (K\({}_{i}\)) is the shared key between every node (i) in the network and the trusted base station and used to verify node identities and exchange data securely. The derivation of this key for each node is as follows:  
\[K_{i}=F(K_{m},S_{i}) \tag{5}\]  
where F( ) is a secure hash function, K\({}_{m}\) is the master key and S\({}_{i}\) is the unique identifier (number) for the i-th sensor node.  
(2) The **pair-wise key** (K\({}_{ij}\)) is the shared key between two neighboring nodes i and j, such as each GM and its CH in a cluster and every CH and its parent in the network, and it is computed as follows:  
\[K_{ij}=F(K_{m},S_{i},S_{j})\qquad where\ S_{i}<S_{j} \tag{6}\]  
Notice that since both nodes have the master key, they both can compute the pair-wise key. This key now can be used to send information from S\({}_{i}\) to S\({}_{j}\) (and vice versa) in a secure and authenticated manner. Also this key is needed especially for aggregation process and data fusion at the CH. In order to support aggregation process, CHs need to be able to look at data sent by their GMs and perform some function on the data if necessary.  
\begin{table}
\begin{tabular}{|p{113.8 pt}|p{113.8 pt}|} \hline \multicolumn{1}{|c||}{**Notation**} & \multicolumn{1}{c||}{**Meaning**} \\ \hline K\({}_{\text{ij}}\) & Symmetric key shared betwcen node i and j. \\ \hline MAC\({}_{\text{K}}\)(**M**) & Message authentication code of M using key K. \\ \hline E\({}_{\text{K}}\)(**M**) & Encryption of M using key K. \\ \hline S\({}_{\text{i}}\) & Identification number of node i. \\ \hline M\({}_{\text{1}}\)\(|\)M\({}_{\text{2}}\) & Concatenation of M\({}_{\text{1}}\) and M\({}_{\text{2}}\) \\ \hline \end{tabular}
\end{table}
Table 1: Security Notations used in Security Formulas.  
(3) The **unique-cluster key** (K\({}_{ch}\)) is the shared key within a cluster in the network and it is different from other cluster-keys of other clusters. This key is used for command dissemination and broadcasting messages and it is generated as follows:  
\[K_{ch}=F(K_{m},S_{i},S_{i}) \tag{7}\]  
where S\({}_{i}\) is the unique identifier number for the cluster head. Once the unique-cluster key is settled, node i can broadcast commands/messages to all the nodes in the cluster encrypted and authenticated using K\({}_{ch}\).