## 3 Sensor Data Security Estimator
### Proposed Security Metrics
#### 3.2.2 Resilience Probability of the Key Management Scheme
Depending on the desired probability of connection \(p\) and the number of keys \(k\) stored by each node, the size of the key pool \(|K|\) can be determined. In other words, for nodes storing \(k\) keys on their key ring, determine what should be the appropriate size of \(K\), such that the probability of any two nodes sharing \(q\) keys in common is \(\geq p\). [PERSON] _et al._[22] show that the key pool size \(|K|\) can be computed as follows. Let \(p(i)\) be the probability that any two nodes in the network have exactly \(i\) keys in common. Any given node has \(\binom{|K|}{k}\) distinct ways of choosing \(k\) keys from the key pool of size \(|K|\). Therefore, \(\binom{|K|}{k}^{2}\) is the total number of ways of any two nodes choosing \(k\) keys each. If we suppose that these two nodes have \(i\) common keys, then \(\binom{|K|}{i}\) is the number of ways for both nodes to choose the \(i\) keys in common. Once the \(i\) common keys have been selected, \(2(k-i)\) distinct keys in the two key rings are yet to be selected from the remaining key pool of size \(|K|-i\). This can be done in \(\binom{|K|-i}{2(k-i)}\) different ways. Next, the \(2(k-i)\) distinct keys must be equally divided between the two nodes. This division can be done in \(\binom{2(k-i)}{(k-i)}\) different ways. Hence, the total number of ways one can choose two key rings with \(i\) keys in common is the product of the three terms previously mentioned, that is \(\binom{|K|}{i}\binom{|K|-i}{2(k-i)}\binom{2(k-i)}{(k-i)}\). Hence, we have:  
\[p(i)=\frac{\binom{|K|}{i}\binom{|K|-i}{2(k-i)}\binom{2(k-i)}{(k-i)}}{\binom{|K |}{k}^{2}} \tag{9}\]  
Let \(p_{connect}\) be the probability that any two nodes have sufficient keys in common to establish a secure connection. Hence, we have \(p_{connect}=1-\)(the probability that the two nodes have insufficient keys in common to establish a secure connection). Thus:  
\[p_{connect}=1-(p(0)+p(1)+\ldots+p(q-1)) \tag{10}\]  
Hence, for a given key ring size \(k\), minimum key overlap \(q\) and minimum connection probability \(p\), the largest \(|K|\) should be chosen, such that \(p_{connect}\geq p\). [PERSON] _et al._ show that the value of parameters \(k\), \(q\) and \(p\) must be chosen according to the network size and the average neighborhood size of the nodes. Once these values are set, for a given network, the value of \(|K|\) can then be computed, and the network can, therefore, be deployed. In such a network, given the fact that nodes share common keys, the capture of \(x\) nodes can compromise the secure communication links between nodes, which are not included in the \(x\) captured nodes. Our aim is to compute \(P_{C}(x)\) (the probability that any given link is compromised when \(x\) nodes are captured) for the q-composite scheme. [PERSON] _et al._ compute \(P_{C}(x)\) as follows. Since each node has \(k\) keys, the probability that a given key has not been compromised is \(\left(1-\frac{k}{|K|}\right)^{x}\). The expected fraction of total keys compromised is thus \(1-\left(1-\frac{k}{|K|}\right)^{x}\). For any secure communication link between two nodes, if its link key was the hash of \(i\) common keys, then the probability of that link being compromised is \(\left(1-\left(1-\frac{k}{|K|}\right)^{x}\right)^{i}\). The probability of establishing a secure link is \(p=p(q)+p(q+1)+\ldots+p(k)\). Therefore, for q-composite:  
\[P_{C}(x)=\sum_{i=q}^{k}\left(1-\left(1-\frac{k}{|K|}\right)^{x}\right)^{i} \frac{p(i)}{p} \tag{11}\]  
This equation also represents the fraction of secure communications independent of the captured nodes that an adversary can compromise based on the information retrieved from the \(x\) captured nodes. With the equation above, SDSE can calculate the resiliency probability \(P_{R}(x)\) for the q-composite scheme applying Equation (7). **Obtaining Parameters \(k\)**, \(q\), \(p\), \(K\)** and \(x\). As can be seen in [22], the values of \(k\), \(q\), \(p\) and \(K\) are based on the network size and the average neighborhood of the nodes.