# FarpScun: Fully Anonymous Routing Protocol with Self-Healing Capability in Unstable Sensor Networks
## 3 Fully Anonymous Routing Protocol with Self-Healing Capability
### Anonymous Identities Scheme
#### 3.3.1 Generation and Sharing of Anonymous Keys  
The anonymous keys are introduced in order to calculate the anonymous identities of two nodes when they communicate. Here, we use the \(DH\) algorithm to realize the generation and sharing of anonymous \(\mathit{Key}_{i,N}\). We introduce a security parameter \(\lambda\) to make the system more secure. The security parameter \(\lambda\) is used to generate the system parameters \(SP\)=((\(\mathbb{G}_{0}\),\(p\),\(\mathcal{S}\)) that are needed for the anonymous key generation and sharing. With the increase of security parameters, the length of the key will be increased, and the ability of the system to resist adversary calculation is greatly enhanced. The system parameter generation algorithm takes as input a security parameter \(\lambda\). Here, the security parameter delegates the length of the prime number. We have set \(\lambda\) over 384 bit length according to the latest \(NIST\) standard (i.e. 512 bit-length). Subsequently, the system parameter generation algorithm generates security parameters. We let \(\mathbb{G}\) denote a generic, polynomial-time, group-generation algorithm, which takes \(1^{\lambda}\) as input and outputs a cyclic group \(\mathbb{G}_{0}\), with its prime order \(p\) ( \(|\,|\,p\,|\) =\(\lambda\) ), and one of its generators \(g\in\mathbb{G}_{0}\). It chooses the cyclic group (\(\mathbb{G}_{0}\),\(p\),\(\mathcal{S}\)) and returns the system parameters \(SP\) = (\(\mathbb{G}_{0}\),\(p\),\(\mathcal{S}\)). In Wireless Sensor Networks, node \(N\) is a neighbor of Node \(i\). First, node \(i\) and node \(N\) negotiate with the multiplication group \(\mathbb{G}_{0}\) of prime order p, where the generator of \(\mathbb{G}_{0}\) is \(g\). Then, node \(i\) chooses a random natural number \(r_{1}\), calculates \(X=g^{r_{1}}\) mod \(p\) and sends \(X\) to node \(N\). Node \(N\) chooses a random natural number \(r_{2}\), calculates \(Y=g^{r_{2}}\) mod \(p\) and sends \(Y\) to node \(i\). Node \(i\) calculates \(\mathit{Key}_{i,N}=Y^{r_{1}}\) mod \(p=g^{r_{1}r_{2}}\) mod \(p\) after receiving \(Y\), and node \(N\) calculates \(\mathit{Key}_{i,N}=X^{r_{2}}\) mod \(p=g^{r_{1}r_{2}}\) mod \(p\) after receiving \(X\). Because of the fact that the DH Algorithm itself does not provide any information about the identity of the two parties, it is vulnerable to the limitations of the man-in-the-middle attack. We introduce an additional auxiliary tool, the \(CA\) authentication center in the \(PKI\) system, to provide \begin{table}
\begin{tabular}{l l} \hline \hline
**Symbol** & **Meaning** \\ \hline \(\mathit{Key}_{i,N}\) & Paired keys shared by node i and neighbor node \(N\) \\ \(HIA_{ID,i\
eq j}\) & One-hop anonymous identity shared between node \(i\) and node \(j\) \\ \(\mathit{Key}_{i\leftrightarrow j}\) & The shared key between node \(i\) and node \(j\) used to update their \\  & anonymous identities \\ \(D_{i\to j}\) & Data transferred from node \(i\) to node \(j\) \\ \(H_{1}\),\(H_{2}\) & Hash functions \\ \(pk_{G}\) & Public key of destination node \(G\) \\ \(\mathit{sk}_{G}\) & Private key of destination node \(G\) \\ \(R\) & A random number \\ \(S\) & The source node with address \(S\) \\ \(G\) & The destination node with address \(G\) \\ \(z_{N_{i}}\) & A symmetric key of \(N_{i}\) used in RREP process \\ \(\mathit{Sess}ID\) & A unique Session ID used in RREQ and RREP processes \\ \(K_{N_{i}}\) & The key of \(N_{i}\) used to unlock additional routing packets \\ \(ID_{i}\) & The real ID of node i \\ \(\lambda\) & security parameter \\ \(\mathbb{G}_{0}\),\(\mathbb{G}_{1}\),\(\mathbb{G}_{2}\) & cyclic group \\ \(p\) & prime order \\ \(g\) & generator \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Symbols definition. authentication to the public key. Digital Certificate provides a simple way to release public key. All of the participants release their public key by applying to \(CA\) for authentication, and verify to \(CA\) that they have obtained other party's public key.