# FarpScun: Fully Anonymous Routing Protocol with Self-Healing Capability in Unstable Sensor Networks
## 3 Fully Anonymous Routing Protocol with Self-Healing Capability
### Fully Anonymous Routing Protocol with Self-Hailing Capability
#### 3.4.1 Establishment of On-Demand Anonymous Routes
Paillier homomorphic encryption can carry out mathematical operation on the basis of non-decrypted data, which is equivalent to the operation on the original data [20]. In this case, the system allows for the encrypted data to be processed directly without decryption. Using the Paillier homomorphism property, when \(Merge\left(E\left(N,pk_{G}\right),\alpha\right)\) is calculated, it is directly operated on the basis of the encrypted data, and there is no decryption operation for \(\alpha\). On the other hand,when \(Merge\left(E\left(z_{N},pk_{G}\right),\mu\right)\) is calculated, it is directly operated on the basis of the encrypted data, and there is no decryption operation for \(\mu\). Specifically, we encrypt the address of the source node \(S\) and the address of the next hop \(N\) of the source node to obtain the ciphertext \(c\):  
\(Merge\left(E\left(N,pk_{G}\right),E(S,pkG)\right)=E(N,pk_{G})^{m}*E(S,pk_{G}) (\bmod n^{2})=c\). When the destination node receives the ciphertext \(c\), the source node and its next hop address can be obtained by decrypting the ciphertext \(c\) using \(Sep1\) and \(Sep2\). The proposed scheme is suitable for wireless sensor networks that are composed of micro devices with very low processing power, storage and battery power. (2) Anonymous RREP process. In the RREP process, a symmetric cryptosystem \(SysLocal\) with polynomial time encryption \(E_{fast}()\) and polynomial time decryption \(D_{fast}()\) is considered. When the message arrives at the destination node \(G\), \(G\) needs to send a reply message to the source node. In this process, we achieve full anonymity from the destination node to the source node. In the route reply process, the destination node uses the key \(z_{N_{i}}\) of each node decrypted to encrypt symmetrically. This is done while using the idea of \"onion routing\", first in the destination node sequential encrypts \(n\) layer, and then in the process of the reply layer by layer decryption. The first layer is encrypted with the symmetric key of the source node, and the second layer is encrypted with the symmetric key of the adjacent node of the source node, and so on, until the destination node's neighbor encrypts the \(n\)th layer, just like an \"onion\". Destination node \(G\) sends the data with three attributes to adjacent node \(N_{m}\). \(E_{pk_{N_{m}}}\left(SessID\right)||HIA_{ID,G+N_{m}}||E_{fast}\left(K_{N_{m}}|| N_{m-1}||Suffix_{m-1},z_{N_{m}}\right)\)  
Suffix is defined, as follows:  
\(Suffix_{i}=E_{fast}\left(K_{N_{i}}||N_{i-1}||Suffix_{i-1},z_{N_{i}}\right)\), i>1,  
\(Suffix_{1}=E_{fast}\left(K_{N_{1}}||S||R,z_{N_{1}}\right)\), R is a random number. Where, \(K_{N_{i}}\) is a node specific key (or a group of keys) for unlocking additional special routing packets \(Pkt\) in the route self-healing process. After the intermediate node \(N_{m}\) receives the data, it can be decrypted with its local symmetric key \(z_{N_{m}}\) in order to gain \(K_{N_{m}}||N_{m-1}||Suffix_{m-1}\). The decrypted \(K_{N_{m}}\) is stored locally, then \(N_{m}\) finds the next node of the reply route via \(N_{m-1}\), and sends the decrypted \(Suffix_{m-1}=E_{fast}\left(K_{N_{m-1}}||N_{m-2}||Suffix_{m-2},z_{N_{m-1}}\right)\) combined with \(SessID\) and the calculated anonymous identity \(HIA_{ID,m+m-1}\) to the next node \(N_{m-1}\), and so on, until the data reaches the source node \(S\). When the data reaches the source node \(S\), the source node decrypts it to have a \(K_{N_{S}}\), the address of \(S\) and a random real number \(R\), and the process terminates.