## 3 Sensor Data Security Estimator
### Proposed Security Metrics
#### 3.2.1 Key Strength Probability of the Cryptography Algorithm  
**Metric Definition**. The metric \(P_{F}(t)\), key strength probability, represents the probability of a cryptographic key (\(c\)) of a sensor to continue to be secure over time \(t\), that is the probability that the key has not been discovered by a brute force attack until time \(t\). This probability varies depending on the cryptography algorithm and its security strength for a given key size [16], as described next. **Features and Vulnerabilities of Cryptography Algorithms**. According to [16], the security \"strength\" (measured in bits) of an algorithm for a given key size (also measured in bits) is described in terms of the amount of work needed to try all possible keys for a symmetric algorithm with a key size of \"X\" that has no shortcut attacks. An algorithm that has a Y-bit key, but whose strength is comparable to an X-bit key, of such a symmetric algorithm is said to have a security strength of X bits. Some symmetric-key algorithms have a strength lower than their key size, although most of the algorithms in common use are designed to have a strength equal to their key size. For example, TDEA (triple data encryption algorithm) has a key size of \(168\) bits, but it provides only \(112\) bits of security, since an attack of complexity \(2^{112}\) is known. In the case of public key cryptography, an algorithm always has a strength lower than the size of its keys [16]. **Metric Computation**. SDSE calculates \(P_{F}(t)\), the probability of key strength of a cryptographic algorithm (for a given key size) at time \(t\), as the complement of the probability of that key to be discovered by a brute force attack, _i.e._, the complement of the success probability of the attack, denoted by \(P_{A}(t)\). Therefore:  
\[P_{F}(t)=1-P_{A}(t) \tag{1}\]  
Thus, by determining \(P_{A}(t)\), we can calculate the value of \(P_{F}(t)\). For a key that has a strength of \(s\) bits, the success probability of an attack, \(P_{A}(t)\), can be obtained by dividing the number of keys that an adversary was able to try until time \(t\), called \(k(t)\), by the total number of possible keys, _i.e._, \(2^{s}\). Therefore:  
\[P_{A}(t)=\frac{k(t)}{2^{s}} \tag{2}\]  
In order to determine \(k(t)\), we just have to multiply the rate \(f\) (the number of keys an adversary can test/try per time unit) by time \(t\), as shown in the following equation:  
\[k(t)=f\cdot t \tag{3}\]  
Substituting Equations (2) and (3) in Equation (1), we can calculate the key strength probability, \(P_{F}(t)\), as follows:  
\[P_{F}(t)=1-\frac{k(t)}{2^{s}}\qquad\Leftrightarrow \tag{4}\] \[P_{F}(t)=1-\frac{f\cdot t}{2^{s}} \tag{5}\]  
As an algorithm with a security strength of \(s\) bits will take \(2^{s}\cdot f^{-1}\) time units to have all possible keys tested, after that time, the probability of a key of the network remaining secure is zero. Thus, we can formally define \(P_{F}(t)\) as follows:  
\[P_{F}(t)=\left\{ \begin{array}{ll}1-\frac{f\cdot t}{2^{s}}&\quad\text{if }t \leq\frac{2^{s}}{f}\\ 0&\quad\text{otherwise}\end{array} \right. \tag{6}\]Hence, for a given test rate \(f\) and a given security strength \(s\), we can compute the key strength probability as a function of time \(t\). This means that \(P_{F}(t)\) decreases as time goes on, since more keys can be tested at every time unit. Besides representing the probability of a sensor node key not being discovered by a brute force attack, \(P_{F}(t)\) also represents the fraction of network nodes whose keys were not discovered by a brute force attack until time \(t\). **Obtaining Parameters \(t\), \(f\)** and \(s\). For a given key, the parameter \(t\) corresponds to the time elapsed from the moment of activation of that key in a given sensor. Each sensor will have its own value of \(t\), since nodes have their keys activated at different moments, e.g., when they are added to the network or when their key is changed (rekeying). Security strength \(s\) varies depending on the algorithm and the key size used.