# Public Key-Based Authentication and En-Route Filtering Scheme in Wireless Sensor Networks
## 4 The Proposed Scheme
### Report Generation  
During this phase, the authors will discuss how the cluster nodes jointly generate a signed report for an event. Suppose that there are \(Nc\) (\(Nc\geq 2t-1\)) cluster nodes in an event area, all of which can detect any event in that event area. When an event occurs, \(t\) of them should participate in report generation. Then, \(t\) out of \(Nc\) cluster nodes for generating the report should be chosen. [PERSON] et al. [1] designed a selection method, however, this method requires that the event values observed by different cluster nodes must be exactly the same but, in fact, the event values observed by different cluster nodes usually have some deviations. Thus, the \(t\) participating nodes selected by different cluster nodes might be different, which will affect the generation of the event report. To overcome this drawback, an improved method for selecting participating nodes is designed in the current study, as follows. When an event occurs, each cluster node in the event area sets a random timer. Upon the timer expiration, it will broadcast its observed values of the event in the form of {\(E\), \(L_{e}\), \(t_{e}\)}, where \(E\) is the event type, \(L_{e}\) is the event location, and \(t_{e}\) is the event time. When another cluster node finds that the broadcast values are consistent with what it observes within the predefined error range, it will record them and cancel its own timer. Subsequent to that, each cluster node sets a timer \(TRG\), indicating that the report generation phase starts. The CH should send out the signed report before the timer expires. When a cluster node hears the correct signed report sent by the CH, it will cancel the timer \(TRG\), indicating that the report generation phase ends. Additionally, each cluster node sets a variable _Fail_flag_, which is initialized to _false_, indicating that the report generation does not fail. Then, each cluster node detecting the same event uses a hash function to map {\(E\), \(L_{e}\), \(t_{e}\)} to a reference value \(hv\) within the same range of cluster node IDs. Then, the \(t\) trusted cluster nodes, whose IDs are closer to \(hv\) than the others, are picked to participate in report generation, among which the node whose ID is closest to \(hv\) becomes the CH. Each cluster node can determine the \(t\) IDs because each cluster node knows the range of cluster node IDs in the same event area. Following selection of the \(t\) participating nodes, each cluster node prepares an original report for the event in the form of \(M=\{CID,ID_{ch},E,L_{e},t_{e}\}\), where \(CID\) is the cluster ID, and \(ID_{ch}\) is ID of the CH. Then, the event report \(M\) is divided into two parts: \(C\) and \(V\). \(C\) holds {\(ID_{ch}\), \(E\), \(L_{e}\)}, while \(V\) holds {\(CID\), \(ID_{ch}\), \(L_{e}\), \(t_{e}\)}, for example. Since some redundant information is included in \(C\), \(\mid C\mid+\mid V\mid\geq\mid M\mid\). Suppose the \(t\) participating nodes are \(v_{IDI}\), \(v_{ID2}\),..., \(v_{IDI}\), among which \(v_{IDI}\) is the CH. Next, the \(t\) participating nodes perform the following steps to cosion the original event report:  
Step 1. The \(t\) participating nodes jointly construct \(kP\) for encrypting \(C\). Each participating node \(v_{IDj}\) (\(1\leq j\leq t\)) picks a random \(k_{j}\) in [1, \(q-1\)] (\(q\) is the order of the elliptic curve) and sends \(k_{j}P\) to the CH node \(v_{IDi}\) rather than explicit \(k_{j}\), so that \(v_{IDi}\) cannot derive \(k_{j}\) from \(k_{j}P\). Step 2. When a participating node does not send \(k_{j}P\) to \(v_{IDi}\), go to Step 5. Otherwise, \(v_{IDi}\) computes \(R=kP=\sum\limits_{j=1}^{t}k_{j}P\) and broadcasts \(X(R)\) to the participating nodes, where \(X(R)\) is the value of the X-coordinate of \(R\). Note that if \(v_{IDi}\) refuses to broadcast \(X(R)\), it will not obtain partial signatures from the other participating nodes. Then, it might broadcast a substitution message, or refuse to send out the report, or send out a report with an incorrect signature.