## 4 Simulations and Results Analysis
### Security Level  
As the main objective of SDSE is to assess the security of sensor data, simulations have been performed to validate, through accuracy, the security level (Equation (22)) estimated by SDSE for each query response message (carrying sensor data) delivered to the base station. In each simulation, the accuracy of the security level estimated by SDSE is computed as follows. First, several data queries are disseminated throughout the network, from the base station. Then, all network nodes, upon receiving a query, send a respective response message. Each response message received at the base station, according to the route taken, has its respective security level computed by SDSE based on the security metrics proposed for each security mechanism. These messages are then grouped according to their security level. Notice that each message received at the base station may be either secure or corrupted. A secure message is a message that has not suffered any attacks during its way to the base station, _i.e._, a message that was not: (1) forwarded by any node with the security key revealed by a brute force attack; (2) sent through any compromised link; or (3) forwarded by any malicious node (\(M+\)). On the other hand, a corrupted message is a message that has suffered any kind of attack on its way to the base station. At the end of each simulation, for each possible security level (between zero and one), the fraction of secure messages is computed and compared with the respective estimated security level, so that we can calculate the accuracy. For example, suppose that during a simulation, \(3000\) response messages were delivered to the base station. Suppose also that, for \(1000\) of these messages, SDSE estimated a \(SL=0.9\). This means that SDSE expects that each of them is 90% likely to be secure. In other words, SDSE expects that, among these \(1000\) messages, \(900\) are secure and \(100\) are corrupt. Suppose also that, among the \(2000\) remaining messages, \(1500\) messages received a \(SL=0.85\) from SDSE and that \(500\) received a \(SL=0.7\), totaling \(3000\) messages delivered. Following that, out of the group of \(1000\) messages with \(SL=0.9\), the real fraction of secure messages was computed and compared to  
Figure 9: Accuracy of the security degree of a node for which a global alarm has not been generated (\(A-\)) _vs._ the number \(x\) of captured nodes, for different values of base rate (\(P_{M}\)) and a network with \(1000\) nodes. the respective security level estimated. That is, suppose among these \(1000\) messages, \(910\) are secure and \(90\) are corrupt. Therefore, the actual fraction of secure messages is \(0.91\), while SDSE estimated a fraction of \(0.9\), which results in an accuracy of \(1-\frac{|0.91-0.9|}{0.91}\approx\) 98.9%. Then, this same procedure for the calculation of the accuracy is performed for the \(1500\) messages with \(SL=0.85\) and for the \(500\) messages with \(SL=0.7\). At the end of the simulation, the accuracy considered for analysis was obtained by the average of the accuracies of each security level estimated for the messages. The configurations used in the simulations to validate the SL estimation are the following:  
1. Cryptography: RC5 algorithm. * \(f=394,254,429,396\) keys/s; * \(t\) variable, from one to 542 days, randomly selected for each node; * \(s=64\) bits. 2. Key management: q-composite scheme * \(k=200\) keys; * \(q=2\) keys; * \(p=0.33\); * \(x=\) 5% of the network nodes (randomly captured). 3. Intrusion detection system * \(N\), variable for each node, depending on the network topology; * \(m=\frac{N}{2}+1\) nodes; * \(P_{M}\) = 10% of the network nodes; * \(P_{tp}=0.7\); * \(P_{fp}=0.3\); * \(P_{tn}=0.7\); * \(P_{fn}=0.3\). Before showing the accuracy results, we first show the average number of hops traveled by the messages in each simulated network (Figure 10), since the security level estimated takes into account the route traveled by the messages.