# Secure Two-Party Distance Computation Protocols with a Semihonest Third Party and Randomization for Privacy Protection in Wireless Sensor Networks

Authors: Haiping Huang; Tianhe Gong; Ping Chen; Guoxia Qiu; Ruchuan Wang
Journal: International Journal of Distributed Sensor Networks
 (2015)

---

## Abstract

Scenarios in which two nodes who distrust each other in wireless sensor networks (WSNs) would like to know the distance between them are considered. The scenario is designed to protect the private information of WSNs, in this case each node’s location, from the other nodes and from a passive attacker. The goal of the present work is to provide two novel and secure two-party distance computation protocols based on a semihonest model, the first with aid of a third party and the second based on randomization technique. Both of these protocols can extend the calculated value into a real number field. The output of the distance computation and the intermediate values in the proposed protocols are also private and not accessible to a third party or any other attackers. When executing these two protocols, security is guaranteed, and the performances of communication and computation of them are found to be satisfactory when compared to those of other similar protocols.


---

## Body

## 1. Motivation

With the development of the computer and communication technologies, wireless sensor networks have gradually extended into the fabric of human society. Communications between people and things have become a reality so that many researchers have begun to pay attention to wireless sensor networks, where many techniques [1, 2] require secure authentication and secure privacy computation. This is because privacy protection is a significant research point which cannot be ignored in today’s wireless sense applications. The privacy of wireless sensor networks’ entity may appear to be either a natural property or a social characteristic depending on the requirements of specific scenarios. The matter of defining privacy in terms of different applications and realizing privacy protection can be explained in detail through the following scenarios regarding secure communications.Wireless sensor networks can usually be deployed in the enemies’ battle field to monitor military information. Once found, each node has the risk of being captured by enemies so that all nodes do not trust each other. However, these nodes have to cooperate with each other in this unreliable environment in order to complete tasks of data collection. For example, Node A decides to expand its coverage area through enhancing transmitting power in one region to obtain more sensing data. Node A also notices that Node B, possibly the adjacent node of Node A, is also expanding the coverage area of his located region. But the two nodes do not want to collect data in the same area, so they want to know whether there are overlapping areas between their respective regions without disclosing the corresponding location information, in order to avoid the danger of being captured caused by the leakage of location information. If Node A and Node B are able to calculate the distance between their respective regions in the case of keeping geographical location information confidentiality and meanwhile telling each other their respective coverage radiuses, then this problem can be effectively solved: if the distance is too close, it indicates that there is overlap; otherwise there is no overlap.Location information becomes important and confidential in the above scenarios, though the utilization of the respective positions of two participants is the most common method for calculating Euclidean distance. In this case, secure two-party distance computation without revealing location information becomes a vital problem.Secure two-party computation, introduced by Yao, allows two parties to jointly compute any function using their inputs in such a way that(1) the output of the computation is correct and public and (2) the inputs are not revealed to both users [3]. Secure calculation of the distance between two parties (or two nodes in WSNs) is a specific case of secure two-party computation, and it provides a solution to the scenario described above. Currently, there exist two ways of computing the distance, and both of them allow the location of each party to be kept secret. The first requires the help of a third party, and the other does not. The primary contribution of this paper is that it puts forward two novel, secure, and efficient protocols that can be used in accordance with the above two methods.The rest of the paper is organized as follows. The next section reviews related works in the field of secure two-party distance computation. Section3 presents the preliminaries and assumptions. Section 4 provides two novel and secure two-party distance computation protocols used in WSN, the first involving a semihonest third party and the other involving randomization technique, and their respective correctness proofs. Security analysis and performance comparisons between the proposals and previous work are presented in Sections 5 and 6, respectively. Further discussions about sensitive issues are given in Section 7. Section 8 concludes this paper.


## 2. Related Work

Secure two-party computation is widely used in network security protocol design to protect important information related to location, identity, and healthcare. Recently, location information during the use of location-based services (LBSs) has raised considerable concerns [12], especially in distance calculation application. Currently, secure two-party distance protocols are generally divided into three categories. The first [4–7] is established using a homomorphic encryption mechanism that serves as the secure basis of privacy protection. The second [8, 13] is established with the assistance of a third party, usually a semihonest third party. The third [14] is established with the randomization technique.As the first type of protocol, [4] describes and analyzes a scheme for biometric authentication and it uses homomorphic encryption for secure calculation of Hamming Distance without revealing the participants’ secret information. The work [5] puts forward a secure two-party computation protocol of Euclidean distance using Paillier homomorphic encryption [11] and this protocol is implemented for private querying of face images and maintains low communication overhead. The work [6] also proposes a secure multiparty distance computation protocol, which is also designed based on Paillier homomorphic encryption without a third party. The work [7] suggests a secure, privacy-preserving opportunistic computing (SPOC) framework for healthcare emergency based on a secure scalar product protocol that can be used to design a secure two-party distance computation protocol. Pronounced computational complexity is the common weakness of secure two-party computation protocols based on homomorphic encryption mechanisms. This is difficult to use with resource-constrained outdoor wireless link networks.In the second category protocol, two participants are unable to calculate the distance between them if there is no third party involved. The protocol in [13] involves a quantum private comparison based on the presence of a semihonest third party and it enables two parties to determine whether their information matches without revealing the specifics. The work [8] allows the participant to calculate the distance based on an honest third party for comparison of local data and simultaneously causes private values to be fully grasped by the third party, which is followed by obvious information leakage and security issues that cannot be ignored. Although intervention by a third party may improve the efficiency of computation and communication, this increases network costs. This issue of decreasing the number of secrets learned by a third party is significant here. The distinction between honest and semihonest third parties is illustrated in Section 3.2.Broad application of homomorphic encryption mechanisms results in less use of other digital disguise techniques, such as randomization methods, which can be used to design secure two-party computation protocols. Randomized disguises obscure the real data by adding random elements to them to facilitate privacy protection. For example, [14] provides a randomization method by performing a linear transformation on the real data or a random permutation replacement of the real data to achieve a secure two-party distance computation protocol. The protocol in [9] also involves randomization method and 1 out of m oblivious transfer protocol [11]. Designing a secure and efficient two-party distance computation protocol based on randomized masquerade is mathematically difficult. Many current protocols, such as one described in a previous study [8], can only be used in integer domains and cannot be expanded into real number domains. This limits their use.In wireless sensor networks, literatures related to privacy protection of location and distance [15] can be traced back to 2007. Actually only few literatures apply the distance computation protocols based on privacy protection to data security of wireless sensor networks. To the best of our knowledge, [16] is the first paper that uses the secure distance calculation protocol to solve location privacy in WSNs. The work [17] presents an overview of the solutions that provide source location privacy such as anonymity and unobservability, within a WSN, in relation to the assumptions about the adversary’s capabilities. A location privacy routing protocol (LPR) is proposed in [18] to achieve path diversity, and, combining with fake packet injection, LPR is able to minimize the traffic direction information that an adversary can retrieve from eavesdropping. However, LPR does not provide the data-level privacy protection. The work [19] found out that Lu et al.’s protocol in [7] still has some secure flaws such as user anonymity and mutual authentication, and it presents an improved mobile-healthcare emergency system based on extended chaotic maps for applications of wireless body sensor networks (BSNs).


## 3. Preliminaries and Premises

### 3.1. Definition of Secure Two-Party Computation

There are two participants in WSNs, Node A and Node B. Node A selects a secret inputx and Node B selects another one y. They hope to calculate the function f(x,y) and produce final results but they must keep their respective inputs secret. We call this computation process “secure two-party computation.” Here, x (or y) may be the location information of Node A (or Node B), and f(x,y) may be the distance between the two nodes.


### 3.2. Semihonest Model

Secure two-party computation should guarantee the safety of the information even if one participant behaves deceitfully in the execution of the protocol. The attacker may perform one of two types of attacks: one is active that is called “malicious (or adversarial) model [20]” and another is passive, here called the “semihonest model.” In the malicious model, the attacker manipulates one of the participants into executing the protocol improperly. For example, the attacker may cause a participant to substitute mendacious data for real input in order to interrupt implementation of the protocol. In the semihonest model, the attacker only grasps the entirety of the information of the captive participant, including those intermediate data acquired from the other participant, and the purpose of the attacker is solely to reveal some private information, but the protocol is carried out correctly and all inputs are true. Some researchers refer to the semihonest participant as “honest but curious” [21].Based on the above, the reliability of a third party can be defined (hereinafter abbreviated “TP”). There exist three cases. In the first case, the TP is honest, and both the participants send their secrets to the TP without worrying that the TP will leak any private information. This case is perfect but impractical. In the second case, the TP is dishonest or malicious, and neither participant believes the TP. This case is dangerous. In the third case, the TP is semihonest. The TP executes the protocol faithfully, and all kinds of intermediary data and computational results are recorded. The TP tries to make this information publicly available. In WSNs, base station or the cluster-header usually acts as the role of TP.In the present paper, it is supposed that both participants and TP all follow the semihonest model. Generally, the semihonest secure two-party computation model can be illustrated in detail as follows. This can be used in security proofs of protocols.There exists a mapping functionf:0,1∗×0,1∗↦0,1∗×0,1∗, where f1(x,y) is the first element and π denotes the secure two-party computation protocol. During the implementation of π, the view of the first party view1π(x,y) is represented by (x,r1,m11,m21,…,mt1) (analogously (y,r2,m12,m22,…,mt2) denotes the view of the second party view2π(x,y)). Here, x is the input, r1 denotes the result of random coin toss, and mi1 stands for the ith intermediate message received by the first party. When π is complete, the output of the first party is marked with output1π(x,y) (the output of the second party is output2π(x,y)) and the output of π is outputπ(x,y)=(output1π(x,y),output2π(x,y)).Generally, if there exists a probabilistic polynomial-time algorithm (denoted byS1 or S2) to execute the privacy computation of f, it can be concluded that the following is true:(1)S1x,f1x,y,f2x,yx,y≡view1πx,y,output2πx,yx,y,f1x,y,S2y,f2x,yx,y≡output1πx,y,view2πx,yx,y.Here, the meaning of “≡” is “calculation of indiscernibility,” outputiπ(x,y) is entirely determined by viewiπ(x,y), and both of them are stochastic variables. S1 and S2 are called the time simulators.


### 3.3. Definition of Distance

There are many definitions of distance between two participants, including the Minkowski distance, Hamming distance, and Levenshtein distance [22]. The Minkowski distance is the most common one. It can be expressed using(2)dp=∑i=1nxi-yip1/p.Here xi and yi are from P=(x1,x2,…,xn)∈Rn and Q=y1,y2,…,yn∈Rn, respectively. When p=1, it becomes the Manhattan distance; when p=∞, it becomes the Chebyshev distance; when p=2, it becomes the Euclidean distance, which can be described by (3)d2=∑i=1nxi-yi2.In this paper, the Euclidean distance between two participants is calculated exactly in the two proposed secure protocols.


### 3.4. Privacy Measure

Most researchers use the “calculation of indiscernibility” method to realize security proofs, but this method cannot quantify privacy. If it is necessary to prove that one protocol is absolutely secret (perfect zero leakage), privacy measures become essential because it can validate safety of protocols against attackers more efficiently. However, currently there is no common method of measuring privacy. Although the utilization of information theory can quantify privacy, it has limitations [23, 24]. Specifically, it is only available for the protocols whose input has a linear relationship with output. It cannot be applied to nonlinear protocols.Several symbols and concepts regarding the measurement of privacy are given below. These were used to confirm the validity of the proposed protocol.Xiπ denotes the input of the ith participant in π, and msgiπ is described as the message received by the ith participant. After the beginning of π, one participant receives some information from his partner. In this way, the following can be defined:Hiπ=H(Xiπ): the entropy of stochastic variable Xiπ;Hijπ=H(Xiπ∣msgjπ): the conditional entropy of Xiπ when msgjπ is given and when it implies the uncertainty on Xiπ of the jth participant while receiving msgjπ;mini,j(Hijπ∣Hiπ): the relative privacy of π;mini,j(Hijπ): the absolute privacy of π.Relative privacy is believed to be more likely to reflect the degree of privacy divulgence than the absolute privacy, and it can be standardized to a value between 0 and 1 where 0 represents full leakage and 1 indicates perfect safety (perfect zero leakage).Theorem 1 (see [23]).
Consider thatV,C∈GF(p)n (both V and C are one-dimensional vectors); A is a matrix with m rows and n columns whose element belongs to GF(p)n and rank(A)=k. If there exists a functional dependency relationship among A, V, and C, which can be expressed by A∗V=C, and meanwhile if V has n unknown quantities, then H(V∣C)=(n-k)logp.The proof for Theorem1 is shown in a previous study [23].


## 3.1. Definition of Secure Two-Party Computation

There are two participants in WSNs, Node A and Node B. Node A selects a secret inputx and Node B selects another one y. They hope to calculate the function f(x,y) and produce final results but they must keep their respective inputs secret. We call this computation process “secure two-party computation.” Here, x (or y) may be the location information of Node A (or Node B), and f(x,y) may be the distance between the two nodes.


## 3.2. Semihonest Model

Secure two-party computation should guarantee the safety of the information even if one participant behaves deceitfully in the execution of the protocol. The attacker may perform one of two types of attacks: one is active that is called “malicious (or adversarial) model [20]” and another is passive, here called the “semihonest model.” In the malicious model, the attacker manipulates one of the participants into executing the protocol improperly. For example, the attacker may cause a participant to substitute mendacious data for real input in order to interrupt implementation of the protocol. In the semihonest model, the attacker only grasps the entirety of the information of the captive participant, including those intermediate data acquired from the other participant, and the purpose of the attacker is solely to reveal some private information, but the protocol is carried out correctly and all inputs are true. Some researchers refer to the semihonest participant as “honest but curious” [21].Based on the above, the reliability of a third party can be defined (hereinafter abbreviated “TP”). There exist three cases. In the first case, the TP is honest, and both the participants send their secrets to the TP without worrying that the TP will leak any private information. This case is perfect but impractical. In the second case, the TP is dishonest or malicious, and neither participant believes the TP. This case is dangerous. In the third case, the TP is semihonest. The TP executes the protocol faithfully, and all kinds of intermediary data and computational results are recorded. The TP tries to make this information publicly available. In WSNs, base station or the cluster-header usually acts as the role of TP.In the present paper, it is supposed that both participants and TP all follow the semihonest model. Generally, the semihonest secure two-party computation model can be illustrated in detail as follows. This can be used in security proofs of protocols.There exists a mapping functionf:0,1∗×0,1∗↦0,1∗×0,1∗, where f1(x,y) is the first element and π denotes the secure two-party computation protocol. During the implementation of π, the view of the first party view1π(x,y) is represented by (x,r1,m11,m21,…,mt1) (analogously (y,r2,m12,m22,…,mt2) denotes the view of the second party view2π(x,y)). Here, x is the input, r1 denotes the result of random coin toss, and mi1 stands for the ith intermediate message received by the first party. When π is complete, the output of the first party is marked with output1π(x,y) (the output of the second party is output2π(x,y)) and the output of π is outputπ(x,y)=(output1π(x,y),output2π(x,y)).Generally, if there exists a probabilistic polynomial-time algorithm (denoted byS1 or S2) to execute the privacy computation of f, it can be concluded that the following is true:(1)S1x,f1x,y,f2x,yx,y≡view1πx,y,output2πx,yx,y,f1x,y,S2y,f2x,yx,y≡output1πx,y,view2πx,yx,y.Here, the meaning of “≡” is “calculation of indiscernibility,” outputiπ(x,y) is entirely determined by viewiπ(x,y), and both of them are stochastic variables. S1 and S2 are called the time simulators.


## 3.3. Definition of Distance

There are many definitions of distance between two participants, including the Minkowski distance, Hamming distance, and Levenshtein distance [22]. The Minkowski distance is the most common one. It can be expressed using(2)dp=∑i=1nxi-yip1/p.Here xi and yi are from P=(x1,x2,…,xn)∈Rn and Q=y1,y2,…,yn∈Rn, respectively. When p=1, it becomes the Manhattan distance; when p=∞, it becomes the Chebyshev distance; when p=2, it becomes the Euclidean distance, which can be described by (3)d2=∑i=1nxi-yi2.In this paper, the Euclidean distance between two participants is calculated exactly in the two proposed secure protocols.


## 3.4. Privacy Measure

Most researchers use the “calculation of indiscernibility” method to realize security proofs, but this method cannot quantify privacy. If it is necessary to prove that one protocol is absolutely secret (perfect zero leakage), privacy measures become essential because it can validate safety of protocols against attackers more efficiently. However, currently there is no common method of measuring privacy. Although the utilization of information theory can quantify privacy, it has limitations [23, 24]. Specifically, it is only available for the protocols whose input has a linear relationship with output. It cannot be applied to nonlinear protocols.Several symbols and concepts regarding the measurement of privacy are given below. These were used to confirm the validity of the proposed protocol.Xiπ denotes the input of the ith participant in π, and msgiπ is described as the message received by the ith participant. After the beginning of π, one participant receives some information from his partner. In this way, the following can be defined:Hiπ=H(Xiπ): the entropy of stochastic variable Xiπ;Hijπ=H(Xiπ∣msgjπ): the conditional entropy of Xiπ when msgjπ is given and when it implies the uncertainty on Xiπ of the jth participant while receiving msgjπ;mini,j(Hijπ∣Hiπ): the relative privacy of π;mini,j(Hijπ): the absolute privacy of π.Relative privacy is believed to be more likely to reflect the degree of privacy divulgence than the absolute privacy, and it can be standardized to a value between 0 and 1 where 0 represents full leakage and 1 indicates perfect safety (perfect zero leakage).Theorem 1 (see [23]).
Consider thatV,C∈GF(p)n (both V and C are one-dimensional vectors); A is a matrix with m rows and n columns whose element belongs to GF(p)n and rank(A)=k. If there exists a functional dependency relationship among A, V, and C, which can be expressed by A∗V=C, and meanwhile if V has n unknown quantities, then H(V∣C)=(n-k)logp.The proof for Theorem1 is shown in a previous study [23].


## 4. Two Novel Secure Two-Party Distance Computation Protocols

### 4.1. Description of the TPEDP Protocol

In this section, a novel third party-based Euclidean distance protocol (abbreviated TPEDP) is used to securely calculate the distance between two participants of Node A and Node B. Based on semihonest model, the TPEDP is divided into three phases: the input phase, computation phase, and output phase.Input Phase. Node A selects a secret vector P=(x1,x2,…,xn), and Node B chooses another one Q=(y1,y2,…,yn), where n≥1 and their location information are represented by P and Q, respectively.Output Phase. Through two-party calculation, f(P,Q) is the final result that denotes Euclidean distance PQ2. Node A grasps fa and Node B keeps fb. Equation (4) shows the relationship among those symbols: (4)fa=fP,Q+fb.At last, Node A declares fa and Node B reveals fb, and they share the resulting f(P,Q) according to (4).Computation PhaseStep  0. The TP (a third party, i.e., a base station or a cluster-header) randomly generates two vectors, Ra=(ra1,ra2,…,ran), Rb=(rb1,rb2,…,rbn), and two numbers, p and q. It causes them to satisfy (5). Then the TP sends Ra and p to Node A and Rb and q to Node B. Consider(5)Ra-Rb∗Ra-RbT=p+q.Step  1. Node A receives Ra, calculates P1=P+Ra=(x1+ra1,x2+ra2,…,xn+ran), and sends P1 to Node B.Step  2. Node B computes Q1=Rb-Q=(rb1-y1,rb2-y2,…,rbn-yn) using the received vector Rb and its secret Q. Then Node B generates a random number v, together with P1, and establishes (6). Finally, Node B sends Q1 and s to Node A. Consider(6)s=P1+Q1∗P1+Q1T+2Rb∗QT-2Rb∗P1T-q+v.Step  3. After receiving Q1 and s, Node A calculates u in terms of (7)u=s-2Ra∗Q1T-2Ra∗PT-p.Finally, Node A and Node B determine the distancePQ2 (i.e., d2) with respect to (8)u=d2+v.Here, fa=-u, fb=-v, and f(P,Q)=d2 satisfy the form of (4).Proof (correctness proof).
The TPEDP can achieve the correct result of Euclidean distance between two participants.Proof.
The arithmetic expression of (6) can be expanded as follows: (9)s=P1+Q1∗P1+Q1T+2Rb∗QT-2Rb∗P1T-q+v=∑i=1nxi+rai+rbi-yi2+2∑i=1nrbiyi-2∑i=1nrbixi+rai-q+v=∑i=1nxi-yi+rai+rbi2+2∑i=1nrbiyi-2∑i=1nrbixi+rai-q+v=∑i=1nxi-yi2+∑i=1nrai-rbi2+4∑i=1nrairbi+2∑i=1nxi-yirai+rbi+2∑i=1nrbiyi-2∑i=1nrbixi+rai-q+v=∑i=1nxi-yi2+∑i=1nrai-rbi2+2∑i=1nxirai+2∑i=1nrairbi-yi-q+v=∑i=1nxi-yi2+∑i=1nrai-rbi2+2Ra∗PT+2Ra∗Q1T-q+v.If Q1 and s of (7) are displaced, then (10) can be produced:(10)u=s-2Ra∗Q1T-2Ra∗PT-p=∑i=1nxi-yi2+∑i=1nrai-rbi2+2Ra∗PT+2Ra∗Q1T-q+v-2Ra∗Q1T-2Ra∗PT-p=∑i=1nxi-yi2+∑i=1nrai-rbi2-p-q+v.From (5), the equality of p+q=∑i=1n(rai-rbi)2 can be deduced. It can be substituted into (10). Finally, the expression of u=∑i=1n(xi-yi)2+v=PQ2+v can be concluded and the validity of the TPEDP is proven.


### 4.2. Description of the REDP Protocol

Some outdoor wireless sensor network environments do not allow the existence of a reliable third party, so the two nodes must complete security distance calculation relying only on each other. A randomization technique is used to avoid the high computational complexity produced by homomorphic encryption, and the design of an efficient two-party protocol is described in this section. It is here called the randomization-based Euclidean distance protocol (abbreviated REDP). The difficulty of designing REDP is that it requires randomly camouflaging vectors in the domain of real numbers and it involves exchanging some elements within those modified vectors.It can be supposed that Node A and Node B are semihonest participants and operations in input and output phases of the REDP are identical to those of the TPEDP. Then only the steps of computation phase are displayed as follows.Computation PhaseStep  1. Node A generates a random sequence {ra0,ra1,…,ran} where rai≠0, i∈[0,n], and, for each xi in P (P=(x1,x2,…,xn)), Node A calculates xi′=ra0xi+irai (i=1,2,…,n) which creates a new vector P1=(x1′,x2′,…,xn′). Node A continues to calculate the values of λ and xi′′ according to (11) and (12), respectively, where u, e, and w (u,e,w≠0) are random numbers chosen by Node A:(11)λ=-12ra0u+∑i=1nxi2,(12)xi′′=w-raie,i=1,2,…,n.All xi′′ form a new vector P2=(x1′′,x2′′,…,xn′′), and Node A sends P1, P2, and λ to Node B but keeps {ra0,ra1,…,ran}, e, w, and u secret.Step  2. Node B constructs two fresh vectors Q1=(y1′,y2′,…,yn′)=(rby1,rby2,…,rbyn) and Q2=(y1′′,y2′′,…,yn′′)=(rby1,2rby2,…,nrbyn) with a random number rb (rb≠0) and Q (Q=(y1,y2,…,yn)). Then Node B computes h1, h2, and h3 in terms of (13), (14), and (15), separately, and P1, P2, and λ are obtained from Node A. Consider(13)h1=λrb+P1∗Q1=ra0rbu+∑i=1nxi2+∑i=1nxi′yi′=-12ra0rbu+∑i=1nxi2+∑i=1nra0xi+irairbyi,(14)h2=P2∗Q2=∑i=1nxi′′yi′′=∑i=1nw-raieirbyi,(15)h3=∑i=1nyi′′.At last, Node B sends h1, h2, and h3 to Node A but keeps rb secret.Step  3. Node A determines the value of m on the basis of (16) and sends it to Node B:(16)m=-h1+eh2-weh3ra0.Step  4. Node B obtains the value of v according to (17)v=2mrb+∑i=1nyi2.Finally, Node A and Node B share the value ofPQ2 (i.e., d2) in the light of (18)v=d2+u.Here fa=u, fb=v, and f(P,Q)=d2 all satisfy the form of (4).Proof (correctness proof).
According to (16), (17), and (18), (19) can be deduced:(19)d2=v-u=2mrb+∑i=1nyi2-u=-2h1+eh2-weh3ra0rb+∑i=1nyi2-u.It makes use of the expressions of (13), (14), and (15) to displace h1, h2, and h3 in (19), respectively. Then the following can be concluded:(20)d2=-2-1/2ra0rbu+∑i=1nxi2+∑i=1nra0rbxiyira0rb+∑i=1nyi2-u=u+∑i=1nxi2-2∑i=1nxiyi+∑i=1nyi2-u=∑i=1nxi-yi2.Equation (20) shows the exact computation of the expression of Euclidean distance between Node A and Node B. In this way, the proof is complete.


## 4.1. Description of the TPEDP Protocol

In this section, a novel third party-based Euclidean distance protocol (abbreviated TPEDP) is used to securely calculate the distance between two participants of Node A and Node B. Based on semihonest model, the TPEDP is divided into three phases: the input phase, computation phase, and output phase.Input Phase. Node A selects a secret vector P=(x1,x2,…,xn), and Node B chooses another one Q=(y1,y2,…,yn), where n≥1 and their location information are represented by P and Q, respectively.Output Phase. Through two-party calculation, f(P,Q) is the final result that denotes Euclidean distance PQ2. Node A grasps fa and Node B keeps fb. Equation (4) shows the relationship among those symbols: (4)fa=fP,Q+fb.At last, Node A declares fa and Node B reveals fb, and they share the resulting f(P,Q) according to (4).Computation PhaseStep  0. The TP (a third party, i.e., a base station or a cluster-header) randomly generates two vectors, Ra=(ra1,ra2,…,ran), Rb=(rb1,rb2,…,rbn), and two numbers, p and q. It causes them to satisfy (5). Then the TP sends Ra and p to Node A and Rb and q to Node B. Consider(5)Ra-Rb∗Ra-RbT=p+q.Step  1. Node A receives Ra, calculates P1=P+Ra=(x1+ra1,x2+ra2,…,xn+ran), and sends P1 to Node B.Step  2. Node B computes Q1=Rb-Q=(rb1-y1,rb2-y2,…,rbn-yn) using the received vector Rb and its secret Q. Then Node B generates a random number v, together with P1, and establishes (6). Finally, Node B sends Q1 and s to Node A. Consider(6)s=P1+Q1∗P1+Q1T+2Rb∗QT-2Rb∗P1T-q+v.Step  3. After receiving Q1 and s, Node A calculates u in terms of (7)u=s-2Ra∗Q1T-2Ra∗PT-p.Finally, Node A and Node B determine the distancePQ2 (i.e., d2) with respect to (8)u=d2+v.Here, fa=-u, fb=-v, and f(P,Q)=d2 satisfy the form of (4).Proof (correctness proof).
The TPEDP can achieve the correct result of Euclidean distance between two participants.Proof.
The arithmetic expression of (6) can be expanded as follows: (9)s=P1+Q1∗P1+Q1T+2Rb∗QT-2Rb∗P1T-q+v=∑i=1nxi+rai+rbi-yi2+2∑i=1nrbiyi-2∑i=1nrbixi+rai-q+v=∑i=1nxi-yi+rai+rbi2+2∑i=1nrbiyi-2∑i=1nrbixi+rai-q+v=∑i=1nxi-yi2+∑i=1nrai-rbi2+4∑i=1nrairbi+2∑i=1nxi-yirai+rbi+2∑i=1nrbiyi-2∑i=1nrbixi+rai-q+v=∑i=1nxi-yi2+∑i=1nrai-rbi2+2∑i=1nxirai+2∑i=1nrairbi-yi-q+v=∑i=1nxi-yi2+∑i=1nrai-rbi2+2Ra∗PT+2Ra∗Q1T-q+v.If Q1 and s of (7) are displaced, then (10) can be produced:(10)u=s-2Ra∗Q1T-2Ra∗PT-p=∑i=1nxi-yi2+∑i=1nrai-rbi2+2Ra∗PT+2Ra∗Q1T-q+v-2Ra∗Q1T-2Ra∗PT-p=∑i=1nxi-yi2+∑i=1nrai-rbi2-p-q+v.From (5), the equality of p+q=∑i=1n(rai-rbi)2 can be deduced. It can be substituted into (10). Finally, the expression of u=∑i=1n(xi-yi)2+v=PQ2+v can be concluded and the validity of the TPEDP is proven.


## 4.2. Description of the REDP Protocol

Some outdoor wireless sensor network environments do not allow the existence of a reliable third party, so the two nodes must complete security distance calculation relying only on each other. A randomization technique is used to avoid the high computational complexity produced by homomorphic encryption, and the design of an efficient two-party protocol is described in this section. It is here called the randomization-based Euclidean distance protocol (abbreviated REDP). The difficulty of designing REDP is that it requires randomly camouflaging vectors in the domain of real numbers and it involves exchanging some elements within those modified vectors.It can be supposed that Node A and Node B are semihonest participants and operations in input and output phases of the REDP are identical to those of the TPEDP. Then only the steps of computation phase are displayed as follows.Computation PhaseStep  1. Node A generates a random sequence {ra0,ra1,…,ran} where rai≠0, i∈[0,n], and, for each xi in P (P=(x1,x2,…,xn)), Node A calculates xi′=ra0xi+irai (i=1,2,…,n) which creates a new vector P1=(x1′,x2′,…,xn′). Node A continues to calculate the values of λ and xi′′ according to (11) and (12), respectively, where u, e, and w (u,e,w≠0) are random numbers chosen by Node A:(11)λ=-12ra0u+∑i=1nxi2,(12)xi′′=w-raie,i=1,2,…,n.All xi′′ form a new vector P2=(x1′′,x2′′,…,xn′′), and Node A sends P1, P2, and λ to Node B but keeps {ra0,ra1,…,ran}, e, w, and u secret.Step  2. Node B constructs two fresh vectors Q1=(y1′,y2′,…,yn′)=(rby1,rby2,…,rbyn) and Q2=(y1′′,y2′′,…,yn′′)=(rby1,2rby2,…,nrbyn) with a random number rb (rb≠0) and Q (Q=(y1,y2,…,yn)). Then Node B computes h1, h2, and h3 in terms of (13), (14), and (15), separately, and P1, P2, and λ are obtained from Node A. Consider(13)h1=λrb+P1∗Q1=ra0rbu+∑i=1nxi2+∑i=1nxi′yi′=-12ra0rbu+∑i=1nxi2+∑i=1nra0xi+irairbyi,(14)h2=P2∗Q2=∑i=1nxi′′yi′′=∑i=1nw-raieirbyi,(15)h3=∑i=1nyi′′.At last, Node B sends h1, h2, and h3 to Node A but keeps rb secret.Step  3. Node A determines the value of m on the basis of (16) and sends it to Node B:(16)m=-h1+eh2-weh3ra0.Step  4. Node B obtains the value of v according to (17)v=2mrb+∑i=1nyi2.Finally, Node A and Node B share the value ofPQ2 (i.e., d2) in the light of (18)v=d2+u.Here fa=u, fb=v, and f(P,Q)=d2 all satisfy the form of (4).Proof (correctness proof).
According to (16), (17), and (18), (19) can be deduced:(19)d2=v-u=2mrb+∑i=1nyi2-u=-2h1+eh2-weh3ra0rb+∑i=1nyi2-u.It makes use of the expressions of (13), (14), and (15) to displace h1, h2, and h3 in (19), respectively. Then the following can be concluded:(20)d2=-2-1/2ra0rbu+∑i=1nxi2+∑i=1nra0rbxiyira0rb+∑i=1nyi2-u=u+∑i=1nxi2-2∑i=1nxiyi+∑i=1nyi2-u=∑i=1nxi-yi2.Equation (20) shows the exact computation of the expression of Euclidean distance between Node A and Node B. In this way, the proof is complete.


## 5. Security Analysis

### 5.1. Security of the TPEDP Protocol

In this section, the security of the TPEDP protocol is proven. Node A and Node B cannot learn any private vectors from each other except for the distance between them. This provides a detailed analysis of each step of the TPEDP.(1)
In Step0, the TP receives no reply from either Node A or Node B, so it cannot gain any information from either of the two participants.(2)
In Step1, Node B learns P1=P+Ra from Node A but cannot analyze P because Node B knows nothing about Ra. After receiving P1, Node B encounters a group of nonhomogeneous linear equations with 2n unknown quantities but only n equations. These equations cannot be solved in an algebraic field.(3)
In Step2, Node A receives s, which is the result of scalar products for P1, Q1. For Node A, s and Q1 are equivalent to a group of nonhomogeneous linear equations, including 2n+2(Q,Rb,q,v) unknown quantities, but the n+1 equations are not enough to solve for those elements of Q.(4)
In Step3, owing to adding stochastic number v into (6) by Node B, Node A cannot hold the final result by itself. It means that u is only available to Node A and v is only available to Node B. For any one participant, (8) has two unknown quantities and an infinity of solutions. In this way, neither Node A nor Node B can deduce the value of d2 from their respective data alone. So the scenario protects the secrecy of the information regarding the location of the two participants.In summary, none of the information is compromised during communications among Node A, Node B, and TP. In order to render the procedure of security analysis more convincing, the calculation of indiscernibility method was adopted for further validation.Theorem 2.
The TPEDP (marked withπ1) ensures that Node A and Node B cannot acquire private input of each other.Proof.
Because both Node A and Node B are semihonest participants, it is necessary to prove, in the TPEDP, that the intermediate information obtained by the passive attacker cannot be differentiated from those produced in no-attack and real situations, that is, calculation of indiscernibility.
A simulator must be constructed to imitate all of information acquired by a passive attacker in the executing process of the TPEDP. It can be discretionarily determined whether Node A or Node B is captured by the attacker. For this reason, the simulatorS1 can simulate data from the view of Node A view1π1(P=(x1,x2,…,xn), Q=(y1,y2,…,yn)). In this way, this proof process can be used to verify whether {S1(P,f1(P,Q),f2(P,Q))} and {view1π1(P,Q),output2π1(P,Q)} are equivalent, where view1π1(P,Q)=(P,r1,m11,m21,…,mt1). The location information P=(x1,x2,…,xn) of Node A and the final distance d serve as the inputs of S1.
Input Phase of
π
1. The attacker informs S1 that it will collect all of information held by Node A, including its private location P and the final result d. Because of the absence of Q=(y1,y2,…,yn) which is held by Node B, S1 can only generate one simulated vector Q′=(y1s,y2s,…,yns) that satisfies (3). Here, yi in (3) is replaced by yis.
Computation Phase of
π
1. In Step 0, Node A receives the true data Ra and p distributed by the TP. But S1 still generates simulant data involved in Ra′=(ra1′,ra2′,…,ran′), Rb′=(rb1′,rb2′,…,rbn′), p′, q′ in terms of the result of coin toss r1, and all those values satisfy the form of (5); that is, (Ra′-Rb′)∗Ra′-Rb′T=p′+q′.
In Step1, S1 can calculate P1′=P+Ra′=(x1+ra1′,x2+ra2′,…,xn+ran′) and send P1′ to Node B.
In Step2, Node A receives s and Q1, which are produced by Node B. But S1 can select a random number v′ with Rb′ & q′. These values can be used to simulate the following equalities of Q1′ and s′ in accordance with (6):(21)Q1′=Rb′-Q′=rb1′-y1s,rb2′-y2s,…,rbn′-ynss′=P1′+Q1′∗P1′+Q1′T+Rb′∗Q′T-Rb′∗P1′T-q′+v′.
In Step3, S1 incites Node A to calculate the simulant parameter u′=s′-2Ra′∗Q1′T-2Ra′∗PT-p′.
Output Phase of
π
1. Finally, fa′=-u′, fb′=-v′, and all satisfy the form of (4); that is, fb′=f(P,Q)+fa′. After the exchange of data between Node A and Node B, through simulation, S1 obtains all information of Node A: {fa′,fb′,f(P,Q)}.
However, in each of the steps outlined above, all of the data (denoted byS1(P,d)={P,r1,s′,Q1′,d}) handled by S1 cannot be distinguished from those produced in the normal execution of π1. Because the view of Node A is view1π1(P,Q)={P,r1,s,Q1} and the output of π1 is output1π1(P,Q)=output2π1(P,Q)=d, {S1(P,d),d}≡{view1π1(P,Q),output2π1(P,Q)} can be concluded. This indicates “calculation of indiscernibility.”
Likewise, if the attacker suborns Node B, then the attacker will gather all information in Node B’s possession using another simulator,S2. The view of Node B is view2π1(P=(x1,x2,…,xn), Q=(y1,y2,…,yn)), and the same conclusion of “calculation of indiscernibility” can be drawn: {f1(P,Q), S2(Q,f2(P,Q))} and {output1π1(P,Q),view2π1(P,Q)} are equivalent.
If the attacker captures the TP, then the attacker cannot realize the simulation because the TP has not obtained any information from Node A or Node B at any point in the protocol.
This proves Theorem2.


### 5.2. Security of the REDP Protocol

Node A and Node B cannot obtain any private vectors from each other except for the distance value between them. The following is a detailed analysis of each step in the REDP process.(
1
) In Step 1, Node B receives some data from Node A, including P1=(x1′,x2′,…,xn′), P2=(x1′′,x2′′,…,xn′′), where xi′=ra0xi+irai, xi′′=(w-rai)/e (i=1,2,…,n). However, because Node B cannot learn the specific values of rai, w, or e, it is faced with the difficulty of solving xi with 2n nonlinear polynomial equations but 2n+3 unknown quantities. These can be expressed by (22), where bj (j=1,2,…,n,n+1,…,2n) is a specific constant. Consider(22)x2n+1x1+x1=b1,⋮x2n+1xi+ixi=bi,⋮x2n+1xn+nxn=bn,x2n+2-xn+1x2n+3=bn+1,⋮x2n+2-xn+ix2n+3=bn+i,⋮x2n+2-x2nx2n+3=b2n,i=1,2,…,n.Equation (22) has infinity of solutions. In some cases, such as ra0=1, e=1, (22) can be degraded to a group of nonhomogeneous linear equations group represented by (23). Here, bj (j=1,2,…,n,n+1,…,2n) is a specific constant. Consider(23)x1+xn+1=b1,⋮xi+ixn+i=bi,⋮xn+nx2n=bn,x2n+1-xn+1=bn+1,⋮x2n+1-xn+i=bn+i,⋮x2n+1-x2n=b2n,i=1,2,…,n.Because (23) can be solved using features of the nonhomogeneous linear equations, it shows that the coefficient matrix and the augmented matrix of the equations outlined above have the same rank. For this reason, only the rank of the coefficient matrix is considered. This is displayed as follows:(24)A=1000⋯010⋯0︷numberof"0":n-11000⋯020⋯0︷numberof"0":n-100⋯⋯00⋯0100⋯0n000⋯00-10⋯00100⋯000-1⋯001⋯⋯00⋯0000⋯0-11rA=2n.However, there are 2n+1 unknown quantities in (23) for which the rank of the coefficient matrix is 2n. Equation (23) has an infinite number of solutions because the rank of the augmented matrix (i.e., the number of linearly independent equations) is less than the number of unknown quantities. Even in some extreme situations, (22) still has an infinity of solutions. Node B cannot discriminate u or ra0 from the value of λ. In this way, the data obtained by Node B are not sufficient for detection of any private information regarding location vector P=(x1,x2,…,xn), which is owned by Node A.(
2
) In Step 2, Node A encounters the same problem with respect to solving a group of nonlinear equations. In extreme situations (e.g., if Node B selects rb=1), Node A may choose a zero vector P=0 in input phase. This can be used repeatedly in (13) and (14) after Node A receives h1, h2, and h3. Finally, Node A can deduce the value of rb with considerable probability of success. Even so, Node A still needs to solve a group of nonhomogeneous linear equations with n+1 unknown quantities and only three equations. This problem has an infinite number of solutions. Just by virtue of rb, Node A is unable to infer Node B’s confidential location information Q.(
3
) In Step 3, if Node B utilizes the expressions of (13), (14), and (15) to successively substitute for the values of h1, h2, and h3 in (16), Node B can produce (25)m=-h1+eh2-weh3ra0=--1/2ra0rbu+∑i=1nxi2+∑i=1nra0rbxiyira0=12rbu+∑i=1nxi2-rb∑i=1nxiyi.There is a variety of ways in which Node B might separate individual components such as u+∑i=1nxi2 from (25). During the input phase, Node B may select a special vector Q that only includes one nonzero element to participate in all calculations from Steps 1 to 4. However, this method does not allow Node B to discriminate u+∑i=1nxi2 or ∑i=1nxiyi from (25). Unless Node B uses a zero vector, that is, Q=0, it can determine the value of u+∑i=1nxi2 in Step 3 with considerable probability of success. Using the received value of λ, Node B may determine the value of ra0 after successfully cracking u+∑i=1nxi2. Even so, Node B cannot find solutions to a group of nonlinear polynomial equations with only n+2 equations though the number of unknown quantities is reduced from the original 2n+3 to the current 2n+2.(
4
) The security analysis in Step 4 of this process is the same as the analysis in Step 4 of the TPEDP.In order to make the above security analysis more persuadable, it must be proven that the intermediate information obtained by a passive attacker and that produced in no-attack and real situations involve the “calculation of indiscernibility.”Theorem 3.
The REDP (marked withπ2) ensures that Node A and Node B cannot acquire private input regarding each other.Proof.
Because of the premises and assumptions of the simulator and because the process of the input phase of the REDP protocol is similar to that of the TPEDP protocol, the validation procedures of computation and output phases may be paid more attention. It can still be supposed that the passive attacker captures Node A and constructs the simulatorS1 to implement the REDP protocol.
Computation Phase of
π
2. In Step 1, S1 produces {ra0′,ra1′,…,ran′}, u′, w′, and e′ successively according to the results of r1 and then calculates {P1′,P2′,λ′}, which serves as the simulated information that would be sent to Node B.
In Step2, because Node A does not know the real rb generated by Node B, S1 will forge rb′, together with Q′=(y1s,y2s,…,yns) and simulate the intermediate data Q1′, Q2′, h1′, h2′, and h3′, which must be selected by Node B in (13)–(15):(26)Q1′=rby1s,rby2s,…,rbyns,Q2′=rby1s,2rby2s,…,nrbyns,h1′=λ′rb′+P1′∗Q1′=-12ra0′rb′u′+∑i=1nxi2+∑i=1nra0′xi+irai′rb′yis,h2′=P2′∗Q2′=∑i=1nw′-rai′e′irb′yis,h3′=∑i=1nirb′yis.
In Step3, S1 continues to create fa′=u′ and m′=-(h1′+e′h2′-w′e′h3′)/ra0′.
In Step4, S1 obtains fb′=v′=2m′/rb′+∑i=1nyis2 in terms of (17) to complete the simulation for Node B.
Output Phase of
π
2. S1 collects all information of Node A: {fa′,fb′,f(P,Q)}, which satisfy the form of (4); that is, fb′=f(P,Q)+fa′, where fa′=-u′, fb′=-v′.
S
1
(
P
,
d
)
=
{
P
,
r
1
,
h
1
′
,
h
2
′
,
h
3
′
,
d
} cannot be distinguished from all information produced in the normal execution of π2. The view of Node A is view1π2(P,Q)={P,r1,h1,h2,h3} and the output of π2 is output1π2(P,Q)=output2π2(P,Q)=d, so {S1(P,d),d}≡{view1π2(P,Q),output2π2(P,Q)} implies “calculation of indiscernibility.”
The same conclusion can be drawn if the participant captured by the attacker is Node B.
This proves Theorem3.


## 5.1. Security of the TPEDP Protocol

In this section, the security of the TPEDP protocol is proven. Node A and Node B cannot learn any private vectors from each other except for the distance between them. This provides a detailed analysis of each step of the TPEDP.(1)
In Step0, the TP receives no reply from either Node A or Node B, so it cannot gain any information from either of the two participants.(2)
In Step1, Node B learns P1=P+Ra from Node A but cannot analyze P because Node B knows nothing about Ra. After receiving P1, Node B encounters a group of nonhomogeneous linear equations with 2n unknown quantities but only n equations. These equations cannot be solved in an algebraic field.(3)
In Step2, Node A receives s, which is the result of scalar products for P1, Q1. For Node A, s and Q1 are equivalent to a group of nonhomogeneous linear equations, including 2n+2(Q,Rb,q,v) unknown quantities, but the n+1 equations are not enough to solve for those elements of Q.(4)
In Step3, owing to adding stochastic number v into (6) by Node B, Node A cannot hold the final result by itself. It means that u is only available to Node A and v is only available to Node B. For any one participant, (8) has two unknown quantities and an infinity of solutions. In this way, neither Node A nor Node B can deduce the value of d2 from their respective data alone. So the scenario protects the secrecy of the information regarding the location of the two participants.In summary, none of the information is compromised during communications among Node A, Node B, and TP. In order to render the procedure of security analysis more convincing, the calculation of indiscernibility method was adopted for further validation.Theorem 2.
The TPEDP (marked withπ1) ensures that Node A and Node B cannot acquire private input of each other.Proof.
Because both Node A and Node B are semihonest participants, it is necessary to prove, in the TPEDP, that the intermediate information obtained by the passive attacker cannot be differentiated from those produced in no-attack and real situations, that is, calculation of indiscernibility.
A simulator must be constructed to imitate all of information acquired by a passive attacker in the executing process of the TPEDP. It can be discretionarily determined whether Node A or Node B is captured by the attacker. For this reason, the simulatorS1 can simulate data from the view of Node A view1π1(P=(x1,x2,…,xn), Q=(y1,y2,…,yn)). In this way, this proof process can be used to verify whether {S1(P,f1(P,Q),f2(P,Q))} and {view1π1(P,Q),output2π1(P,Q)} are equivalent, where view1π1(P,Q)=(P,r1,m11,m21,…,mt1). The location information P=(x1,x2,…,xn) of Node A and the final distance d serve as the inputs of S1.
Input Phase of
π
1. The attacker informs S1 that it will collect all of information held by Node A, including its private location P and the final result d. Because of the absence of Q=(y1,y2,…,yn) which is held by Node B, S1 can only generate one simulated vector Q′=(y1s,y2s,…,yns) that satisfies (3). Here, yi in (3) is replaced by yis.
Computation Phase of
π
1. In Step 0, Node A receives the true data Ra and p distributed by the TP. But S1 still generates simulant data involved in Ra′=(ra1′,ra2′,…,ran′), Rb′=(rb1′,rb2′,…,rbn′), p′, q′ in terms of the result of coin toss r1, and all those values satisfy the form of (5); that is, (Ra′-Rb′)∗Ra′-Rb′T=p′+q′.
In Step1, S1 can calculate P1′=P+Ra′=(x1+ra1′,x2+ra2′,…,xn+ran′) and send P1′ to Node B.
In Step2, Node A receives s and Q1, which are produced by Node B. But S1 can select a random number v′ with Rb′ & q′. These values can be used to simulate the following equalities of Q1′ and s′ in accordance with (6):(21)Q1′=Rb′-Q′=rb1′-y1s,rb2′-y2s,…,rbn′-ynss′=P1′+Q1′∗P1′+Q1′T+Rb′∗Q′T-Rb′∗P1′T-q′+v′.
In Step3, S1 incites Node A to calculate the simulant parameter u′=s′-2Ra′∗Q1′T-2Ra′∗PT-p′.
Output Phase of
π
1. Finally, fa′=-u′, fb′=-v′, and all satisfy the form of (4); that is, fb′=f(P,Q)+fa′. After the exchange of data between Node A and Node B, through simulation, S1 obtains all information of Node A: {fa′,fb′,f(P,Q)}.
However, in each of the steps outlined above, all of the data (denoted byS1(P,d)={P,r1,s′,Q1′,d}) handled by S1 cannot be distinguished from those produced in the normal execution of π1. Because the view of Node A is view1π1(P,Q)={P,r1,s,Q1} and the output of π1 is output1π1(P,Q)=output2π1(P,Q)=d, {S1(P,d),d}≡{view1π1(P,Q),output2π1(P,Q)} can be concluded. This indicates “calculation of indiscernibility.”
Likewise, if the attacker suborns Node B, then the attacker will gather all information in Node B’s possession using another simulator,S2. The view of Node B is view2π1(P=(x1,x2,…,xn), Q=(y1,y2,…,yn)), and the same conclusion of “calculation of indiscernibility” can be drawn: {f1(P,Q), S2(Q,f2(P,Q))} and {output1π1(P,Q),view2π1(P,Q)} are equivalent.
If the attacker captures the TP, then the attacker cannot realize the simulation because the TP has not obtained any information from Node A or Node B at any point in the protocol.
This proves Theorem2.


## 5.2. Security of the REDP Protocol

Node A and Node B cannot obtain any private vectors from each other except for the distance value between them. The following is a detailed analysis of each step in the REDP process.(
1
) In Step 1, Node B receives some data from Node A, including P1=(x1′,x2′,…,xn′), P2=(x1′′,x2′′,…,xn′′), where xi′=ra0xi+irai, xi′′=(w-rai)/e (i=1,2,…,n). However, because Node B cannot learn the specific values of rai, w, or e, it is faced with the difficulty of solving xi with 2n nonlinear polynomial equations but 2n+3 unknown quantities. These can be expressed by (22), where bj (j=1,2,…,n,n+1,…,2n) is a specific constant. Consider(22)x2n+1x1+x1=b1,⋮x2n+1xi+ixi=bi,⋮x2n+1xn+nxn=bn,x2n+2-xn+1x2n+3=bn+1,⋮x2n+2-xn+ix2n+3=bn+i,⋮x2n+2-x2nx2n+3=b2n,i=1,2,…,n.Equation (22) has infinity of solutions. In some cases, such as ra0=1, e=1, (22) can be degraded to a group of nonhomogeneous linear equations group represented by (23). Here, bj (j=1,2,…,n,n+1,…,2n) is a specific constant. Consider(23)x1+xn+1=b1,⋮xi+ixn+i=bi,⋮xn+nx2n=bn,x2n+1-xn+1=bn+1,⋮x2n+1-xn+i=bn+i,⋮x2n+1-x2n=b2n,i=1,2,…,n.Because (23) can be solved using features of the nonhomogeneous linear equations, it shows that the coefficient matrix and the augmented matrix of the equations outlined above have the same rank. For this reason, only the rank of the coefficient matrix is considered. This is displayed as follows:(24)A=1000⋯010⋯0︷numberof"0":n-11000⋯020⋯0︷numberof"0":n-100⋯⋯00⋯0100⋯0n000⋯00-10⋯00100⋯000-1⋯001⋯⋯00⋯0000⋯0-11rA=2n.However, there are 2n+1 unknown quantities in (23) for which the rank of the coefficient matrix is 2n. Equation (23) has an infinite number of solutions because the rank of the augmented matrix (i.e., the number of linearly independent equations) is less than the number of unknown quantities. Even in some extreme situations, (22) still has an infinity of solutions. Node B cannot discriminate u or ra0 from the value of λ. In this way, the data obtained by Node B are not sufficient for detection of any private information regarding location vector P=(x1,x2,…,xn), which is owned by Node A.(
2
) In Step 2, Node A encounters the same problem with respect to solving a group of nonlinear equations. In extreme situations (e.g., if Node B selects rb=1), Node A may choose a zero vector P=0 in input phase. This can be used repeatedly in (13) and (14) after Node A receives h1, h2, and h3. Finally, Node A can deduce the value of rb with considerable probability of success. Even so, Node A still needs to solve a group of nonhomogeneous linear equations with n+1 unknown quantities and only three equations. This problem has an infinite number of solutions. Just by virtue of rb, Node A is unable to infer Node B’s confidential location information Q.(
3
) In Step 3, if Node B utilizes the expressions of (13), (14), and (15) to successively substitute for the values of h1, h2, and h3 in (16), Node B can produce (25)m=-h1+eh2-weh3ra0=--1/2ra0rbu+∑i=1nxi2+∑i=1nra0rbxiyira0=12rbu+∑i=1nxi2-rb∑i=1nxiyi.There is a variety of ways in which Node B might separate individual components such as u+∑i=1nxi2 from (25). During the input phase, Node B may select a special vector Q that only includes one nonzero element to participate in all calculations from Steps 1 to 4. However, this method does not allow Node B to discriminate u+∑i=1nxi2 or ∑i=1nxiyi from (25). Unless Node B uses a zero vector, that is, Q=0, it can determine the value of u+∑i=1nxi2 in Step 3 with considerable probability of success. Using the received value of λ, Node B may determine the value of ra0 after successfully cracking u+∑i=1nxi2. Even so, Node B cannot find solutions to a group of nonlinear polynomial equations with only n+2 equations though the number of unknown quantities is reduced from the original 2n+3 to the current 2n+2.(
4
) The security analysis in Step 4 of this process is the same as the analysis in Step 4 of the TPEDP.In order to make the above security analysis more persuadable, it must be proven that the intermediate information obtained by a passive attacker and that produced in no-attack and real situations involve the “calculation of indiscernibility.”Theorem 3.
The REDP (marked withπ2) ensures that Node A and Node B cannot acquire private input regarding each other.Proof.
Because of the premises and assumptions of the simulator and because the process of the input phase of the REDP protocol is similar to that of the TPEDP protocol, the validation procedures of computation and output phases may be paid more attention. It can still be supposed that the passive attacker captures Node A and constructs the simulatorS1 to implement the REDP protocol.
Computation Phase of
π
2. In Step 1, S1 produces {ra0′,ra1′,…,ran′}, u′, w′, and e′ successively according to the results of r1 and then calculates {P1′,P2′,λ′}, which serves as the simulated information that would be sent to Node B.
In Step2, because Node A does not know the real rb generated by Node B, S1 will forge rb′, together with Q′=(y1s,y2s,…,yns) and simulate the intermediate data Q1′, Q2′, h1′, h2′, and h3′, which must be selected by Node B in (13)–(15):(26)Q1′=rby1s,rby2s,…,rbyns,Q2′=rby1s,2rby2s,…,nrbyns,h1′=λ′rb′+P1′∗Q1′=-12ra0′rb′u′+∑i=1nxi2+∑i=1nra0′xi+irai′rb′yis,h2′=P2′∗Q2′=∑i=1nw′-rai′e′irb′yis,h3′=∑i=1nirb′yis.
In Step3, S1 continues to create fa′=u′ and m′=-(h1′+e′h2′-w′e′h3′)/ra0′.
In Step4, S1 obtains fb′=v′=2m′/rb′+∑i=1nyis2 in terms of (17) to complete the simulation for Node B.
Output Phase of
π
2. S1 collects all information of Node A: {fa′,fb′,f(P,Q)}, which satisfy the form of (4); that is, fb′=f(P,Q)+fa′, where fa′=-u′, fb′=-v′.
S
1
(
P
,
d
)
=
{
P
,
r
1
,
h
1
′
,
h
2
′
,
h
3
′
,
d
} cannot be distinguished from all information produced in the normal execution of π2. The view of Node A is view1π2(P,Q)={P,r1,h1,h2,h3} and the output of π2 is output1π2(P,Q)=output2π2(P,Q)=d, so {S1(P,d),d}≡{view1π2(P,Q),output2π2(P,Q)} implies “calculation of indiscernibility.”
The same conclusion can be drawn if the participant captured by the attacker is Node B.
This proves Theorem3.


## 6. Efficiency Analysis and Comparisons

In this section, the complexity of communication round is analyzed, and the complexity of computation and the type of data involved in various protocols are also evaluated. These protocols obey semihonest execution rules and their objectives are to determine the result of secure distance computation. One of these protocols in previous study [4] is based on homomorphic encryption, called “Rane’s Scheme.” A similar scheme [5], in which Rane’s Scheme was improved upon, is called “Rane’s Improved Scheme.” Another previous study [8] proposed two kinds of secure two-party closest-pair of points protocols. The first one comprised the computation of distance aided by a third party, and the distance computation procedure can be separated from the protocol itself and called “Huang’s 1st Scheme.” The second one was designed according to discrete logarithm principles without any third party and could be used to realize secure two-party distance computation, called “Huang’s 2nd Scheme.” Luo’s Scheme, Lu’s Scheme, and Li’s Scheme are introduced, respectively, in [6], [7], and [9] in the Related Work section. Lu’s Scheme only realized a scalar product protocol, but, through it, a distance calculation protocol can be simulated at no extra cost. Table 1 lists the results of a comparison of the protocols given above from several perspectives.Table 1
Secure two-party distance computation protocols.
Communication round complexity
Computation complexity
Data type
Need for a third party
Degree of privacy protection
TPEDP
2
O
(
n
)
Real
Yes
1 (perfect zero leakage)
REDP
3
O
(
n
)
Real
No
Zero leakage
Rane’s Scheme [4]
n
O
(
n
3
)
Integer
No
Zero leakage
Rane’s Improved Scheme [5]
n
O
(
n
3
)
Real
No
Zero leakage
Luo’s Scheme [6]
2
O
(
n
3
)
Real
No
Zero leakage
Lu’s Scheme [7]
n
O
(
n
3
)
Real
No
Zero leakage
Huang’s 1st Scheme [8]
3
O
(
n
)
Real
Yes
The TP obtains all messages from two participants
Huang’s 2nd Scheme [8]
2
O
(
n
)
Integer
No
Zero leakage
Li’s Scheme [9]
10
O
(
n
2
)
Real
No
One participant obtains all messages from another
Note: for a fair comparison, a specific effective algorithm in [10], whose communications round complexity is 2 and computational cost is 2n+2 exponential modulo operation, is selected as the complement of oblivious transfer protocol OTn1 [11] of Li’s Scheme [9].(a) Communication Round Complexity. As shown in Table 1, communication round complexities of those protocols are almost roughly the same level except for Li’s Scheme, which includes many communication steps. Rounds of communication in Lu’s Scheme, Rane’s Scheme, and the Rane’s Improved Scheme are determined by the dimensions of the input vector. However, the dimensions of location information must be less than or equal to 3. Even if there is a third party, the TPEDP can be completed within two rounds, but the REDP has a total of four steps and three rounds of interaction, so the complexity of communication round is 3.(b) Computation Complexity. As shown in Table 1, the overhead of these protocols to generate random numbers can be ignored because that can be addressed in the input phase. The complexity of computation is primarily produced during the computation phase of those protocols, including the TPEDP and REDP. Both of these protocols rely on the dimensions of input vectors, so the computation complexity of them are both O(n).Some protocols based on Paillier additive homomorphic encryption can be used to perform2logN rounds of modular multiplication (modular operator N2) for each encryption and decryption, at most 2d rounds of modular multiplication (modular operator N2) per modular exponential calculation (Exy), where d denotes the number of bits of processed data. For example, the complexity of computation of Rane’s Scheme and its improved one is ((2n+2)logN+2nd+n+1) rounds of modular multiplication (modular operator N2) and that of Lu’s is ((6n+2)logN+(2n+2)d+n) rounds; it means that the computational cost of Rane’s Scheme and its improved one totally includes (n+1) times encryptions, n times modular exponentiations, n times modular multiplications, and once decryption; Luo’s Scheme is not based on Paillier additive homomorphic encryption but rather on another form of encryption. The complexity of the computation can still be evaluated; it is (6nlogN+2nd+2) rounds of modular multiplication (modular operator N2). Generally, the value of N is larger than the dimension n, so the complexity of the computation processes involved in the protocols outlined above is no less than O(n3).(c) Type of Data. Rane’s Scheme shows satisfactory performance with respect to the complexity of rounds of communication, but the types of data that it can process are limited to integer field. Huang’s 2nd Scheme shows the same defect. The two proposed protocols have a broader range of computation because they can be implemented in real number domains.(d) Degree of Privacy Protection. The TP of Huang’s 1st Scheme holds all the information from both participants, so there is no privacy protection at all. Li’s Scheme, which is based on oblivious transfer protocol and involves no TP, has a primary disadvantage that one participant may acquire all results of distance computation and deduce some private information of the other participant. In this case, if one participant can obtain all three distances from three different starting points to the same terminal point, the exact location of the other participant can be calculated. For example, as shown in Figure 1, if Node A holds d11, d12, and d13, which represent distances from points T1, T2, and T3 to point H1, it can deduce the location of Node B, H1, correctly.Figure 1
Deduction of location.Both the TPEDP and REDP use a result-sharing mechanism in which two participants can determine the distance calculation results until publishing their respective random numbers (u and v). This prevents the privacy leakage that can be caused when one participant monopolizes the results. In Section 7.1, especially, it can be proven that the TPEDP protocol’s degree of privacy is 1, that is, the perfect zero leakage.


## 7. Further Discussion

### 7.1. Privacy Measurement Problem of the TPEDP Protocol

Not all protocols can be carried out and used to measure privacy; only those that always satisfy linear dependence between their inputs and intermediate messages can be evaluated for the degree of privacy by using the methods recommended in Section3.4. In this way, only the TPEDP protocol meets the requirements outlined in this paper. In the TPDEP protocol, the impact of TP can be completely ignored, because it only distributed some initial values but did not receive any valid information from either of the two participants.During the running of the TPDEP protocol, all messages received by Node A can be denoted bymsgT={s,p,Q1}, which includes the following: (27)Q1=QT+Rb,p=Ra-Rb∗Ra-RbT-q=Ra∗RaT-2Ra∗RbT+Rb∗RbT-q,s=P1+Q1∗P1+Q1T+2Rb∗QT-2Rb∗P1T-q+v=P1∗P1T+P1∗Q1T+Q1∗P1T+Q1∗Q1T+2Rb∗QT-2Rb∗P1T-q+v=P1∗P1T-2P1∗QT+Rb∗RbT+Q∗QT-q+v.The expressions of p and s can be altered as follows:(28)p=-2Ra∗RbT+Rb∗RbT-q,s=-2P1∗QT+Rb∗RbT+Q∗QT-q+v.These values are related to Node B’s inputs, Q and Rb. For the convenience of measurement of privacy, the expressions of all three elements can be changed as follows:(29)Q1=In∗QT+In∗RbT+0∗Rb∗RbT+0∗Q∗QT+0∗q+0∗v,p=01∗n∗QT-2Ra∗RbT+Rb∗RbT+0∗Q∗QT+0∗q+0∗v,s1=-2P1∗QT+01∗n∗RbT+Rb∗RbT+Q∗QT-q+v.Here, it is supposed that(30)A1=InIn000001∗n-2Ra10-10-2P101∗n11-11,Z1=QTRbRb∗RbTQ∗QTqv,C1=Q1Tps.This satisfies A1∗Z1=C1 (In represents identity matrix). C1 is equivalent to msgT=s,p,Q1 and rank(A1) is n+2. If any participant obtains Q and msgT, he would easily calculate Rb, Rb∗RbT, q, Q∗QT, and v. According to the definitions given in Section 3.4, it can be concluded that H(Rb∣Q,msgT)=H(Rb∗RbT∣Q,msgT)=H(q∣Q,msgT)=HQ∗QTQ,msgT=H(v∣Q,msgT)=  0 and H(Q∣msgT)=H(Q,Rb,Rb∗RbT,Q∗QT,q,v∣msgT). According to Theorem 1, it can finally be deduced that H(Q∣msgT)=nlogp.Next, the degree of privacy is examined from Node B’s perspective. All messages received by Node B can be denoted withmsgH={q,P1}, where the following are true:(31)P1=In∗P+In∗Ra,q=Ra-Rb∗Ra-RbT-p=Ra∗RaT-2Rb∗RaT+Rb∗RbT-p.The expressions ofq and P1 can be altered into(32)P1=In∗P+In∗Ra+0∗Ra∗RaT-0∗p,q=01∗n∗P-2Rb∗RaT+Ra∗RaT-p.Here it is assumed that(33)A2=InIn0001∗n-2Rb1-1,Z2=PRaTRa∗RaTp,C2=P1q.This satisfies A2∗Z2=C2 (In represents identity matrix). Rank(A2) can be shown to be n+1 and C2 can be shown to be msgH. P and msgH allow Ra, Ra∗RaT, and p to be determined. In this way, it is obvious that H(Ra∣P,msgH)=H(Ra∗RaT∣P,msgH)=H(p∣P,msgH)=0, H(P∣msgH)=H(P,Ra,Ra∗RaT,p∣msgH), and H(P∣msgH)=((2n+1)-(n+1))logp=nlogp in terms of Theorem 1.Based on the information given above, the following conclusions can be drawn.Theorem 4.
The result of privacy measure for the TPEDP ismin(H(P∣msgH)/H(P), H(Q∣msgT)/H(Q∣msgT))=1, which implies perfect zero leakage.


### 7.2. The Repeated Calculation Problem of the REDP Protocol

Repeated calculation problem is worth emphasizing. It merits attention from both of the participants in the REDP protocol. An erroneous choice of participants may lead to a serious reduction in privacy. If Node A and Node B meet again after they have executed the REDP protocol at least once, then, during the new execution, the REDP protocol requires fresh initial vectors and random numbers distinguished from those used in the last calculation. A specific example can be cited and used to illustrate this issue, but discussions are not limited to this example.Node A and Node B, who held initial vectorsP and Q, respectively, have completed the REDP protocol once. To run the REDP again, Node B here reselects the initial vector R substituted for Q, but Node A insists on keeping the original vector P and updates the random sequence rai (i=0,1,2,…,n) and random numbers w and e to construct new P1, P2, and λ values. This indicates that Node B may encounter a group of 2n nonlinear polynomial equations when it receives those renewed data from Node A. If the new equations in the group are linearly independent from those obtained by Node B in the last execution (Node A held P and Node B held Q), then Node B can obtain a group of 4n nonlinear polynomial equations and 2n+3+n+3=3n+6 unknown quantities. If Node A selects ra0=1, e=1 in the new interaction (though this case is almost impossible), the 4n nonlinear polynomial equations will degenerate into a group of nonhomogeneous linear equations with 3n+6 unknown quantities. In this case, if n<6 (i.e., 4n<3n+6), then Node B cannot learn the value of P because of prohibitively high number of solutions. If n≥6 (i.e., 4n≥3n+6) and the number of unknown quantities is less than the number of equations, then Node B will break P and the location information of Node A is revealed. In this way, if Node A persists in using its original vector, it will be unable to update random sequences and random numbers (such as rai, w, and e) in another running of this protocol. Otherwise, Node B will collect more equations regarding this original vector of Node A, which will increase the risk of loss of privacy. However, in this case, Node A can change the random value of u to produce the corresponding alteration of the results fa and fb.For this reason, extra limitations must be added to the REDP protocol when it is encoded into the wireless communication devices. This can prevent some extreme situations such as selectingra0=1, e=1 in Node A’s computation round. Certainly, a better provision for the REDP protocol is that each participant should try to choose inputs different from those in previous executions to prevent hidden danger unless the location information of the participant has not changed. (This case has a negligible probability for moving entities.) In this way, Node A must only renew the values of u or v.


### 7.3. Availability in Wireless Sensor Networks

It is necessary to verify the availability of TPEDP and REDP in wireless sensor networks. We design such simulation experiments related to distance to observe the changes of network lifetime and energy consumption in the following three scenarios: the first is calculating the distance between Nodes A and B which use the REDP protocol; the second aids TPEDP to achieve the distance calculation (the current cluster-header is “TP”); and the third is based on ECC (elliptic curves cryptography), which is considered as the most lightweight public key method in WSNs, to realize the computation through encryptions, decryptions, and the reliable third party (the base station). To achieve the data-level privacy protection, in the third scenario, Nodes A and B must encrypt their locations separately using the public key of the base station, and the base station decrypts them and calculates the distance between Nodes A and B, and then the base station must encrypt the distance value by their respective public keys and send it to A and B. Finally, Nodes A and B decrypt it and obtain the result. If A and B cannot communicate with the base station within one hop, this method will cause heavy network loads.In order to ensure the validity of comparisons, we make some assumptions aimed at the three scenarios. Shown in Figure2, any two nodes who want to calculate the distance between them in the network can form a group; once a node joins one group it will not be able to join other groups, except the death of the other node in the same group, it will find a new single node with the same situation again to form a new group. In our simulation experiments, nodes would prefer to search the closest neighbor to form a group. All groups repeatedly calculate the distance between two members, until the network life cycle is ended. The base station, especially, does not participate in any group and all packets are in the same size which can be divided exactly by 16. Leach protocol will be used as the clustering and routing protocol in order to ensure path accessibility. If one current cluster-header is dead, it will reselect the new header in terms of Leach protocol. In TPEDP protocol, the same cluster-header can act as the TP for several groups of nodes. Detailed simulation parameters can be shown in Table 2.Table 2
Simulation parameters setting.
Parameters
The setting value
Network range
400 *   400 m2
Distribution of sensor nodes
Uniform distribution with the number from 100 to 400 nodes, and the base station is in the center
Clustering and routing protocol
Leach
The number of dimensions of location information
n
=
3, n=8
Original energy of node
20 J (infinite energy for the base station)
Energy consumption when sending a packet (at mostd = 128 bits)
0.35 J
Energy consumption when receiving a packet (at mostd = 128 bits)
0.15 J
Energy consumption when processing one bit (at mostd = 128 bits)
0.0005 J
Energy consumption when encrypting or decrypting one bit with ECC (at mostd = 128 bits)
0.0005 J
Energy consumption when processing a modular multiplication (modular operatorN2) (at most d = 128 bits)
0.001 J
Communication radius of node
50 m
Modular operatorN2
N
=
79, N2=6241Figure 2
Three simulation scenarios.We set two cases “n=3, d=64 bits” and “n=8, d=96 bits” to reflect the trend of network lifetime, based on the comparisons of REDP, TPEDP, and ECC, seen in Figures 3(a) and 3(b), respectively. We can watch that, with the increase of sensor nodes, the network lifetimes of three scenarios (or protocols?) appear to decline (or downtrend?) after a little growth in the initial stage. There exit different reasons of these phenomena for REDP, TPEDP, and ECC. There still exit some active sensor nodes in REDP (or TPEDP) because they cannot find another neighbor (or a suitable TP) in their communication ranges when the number of nodes is 100; however the lifecycle is terminated. With the increase of sensor nodes, the above symptoms will be relieved; for instance, the number of nodes is 150 or 200. With the further raise of the number of nodes (350 or 400), more and more new groups emerge while some previous groups are still running, which causes more communication costs, so the lifetime is shortened. Owing to direct or multihop communication to the base station for each node in the network, the secure distance calculation based on ECC would lead to more energy consumption, compared with REDP and TPEDP. Similarly, 100 nodes are uniformly distributed in 400 ∗ 400 field, however some active nodes have never been able to establish the paths to the base station before their lifecycles end. The suitable enhancement of sensor nodes would create more paths to the base station, which can prolong the network lifetime. However, when the number of nodes is 250 or more, many nodes will play the role of relay to achieve more paths, which causes the decline of lifecycle because of more energy consumption. It is worthy to notice that parameters n and d make have influence on the lifetime of REDP and TPEDP, which in Figure 3(b) is less than Figure 3(a), and the larger the n and d, the more the computation cost of the two protocols. However, the increase of the values of n and d cannot affect the decline of ECC too much, even if it also brings more computational overhead. Compared with TPEDP, REDP causes more energy consumption because of the requirements for more communication rounds and the cost of reselection of new cluster-headers for TP.Figure 3
Comparisons of network lifetime among REDP, TPEDP, and ECC.
(a)
(b)


### 7.4. Extended Multiparty Computation

The flexibility characteristics of the TPEDP and REDP protocols make them conveniently transform from two-party distance computation to multi-party distance computation. We suppose that there are totallym nodes in WSNs, and they can be denoted by U1,U2,…,Um and hold their secret inputs P1,P2,…,Pm, respectively, where P1=p11,p12,…,p1n,…,Pm={pm1,pm2,…,pmn} are all n-dimensional vectors. In a security multiparty distance protocol, any one of the nodes Ui (i=1,2,…,m) expects that it can achieve the correct distance value with any other node Uj (j=1,2,…,m & i≠j) without release of its secret; however Ui cannot obtain any privacy from Uj. So the output phase can be described as follows: f(Ui,Uj) is the final result that denotes Euclidean distance UiUj2, Ui grasps fUi, and Uj keeps fUj. Equation (4) shows the relationship among those symbols: (34)fUi=fUi,Uj+fUj.At last, Ui declares fUi and Uj reveals fUj, and they share the resulting f(Ui,Uj) according to (34).The details of calculation are determined by the specific protocol. IfU1,U2,…,Um select their respective random number denoted by θ1,θ2,…,θm in the calculation procedure, θi=UiUj2+θj can be used to represent the final result that keeps the same form of (34). For example, another participant (holds vector R and random number r) other than Node A and Node B can easily enjoy the implement of the two proposed protocols, which need to be upgraded simply, and the results would be shared by the form of u=PQ2+v, u=PR2+r and v=QR2+r.


## 7.1. Privacy Measurement Problem of the TPEDP Protocol

Not all protocols can be carried out and used to measure privacy; only those that always satisfy linear dependence between their inputs and intermediate messages can be evaluated for the degree of privacy by using the methods recommended in Section3.4. In this way, only the TPEDP protocol meets the requirements outlined in this paper. In the TPDEP protocol, the impact of TP can be completely ignored, because it only distributed some initial values but did not receive any valid information from either of the two participants.During the running of the TPDEP protocol, all messages received by Node A can be denoted bymsgT={s,p,Q1}, which includes the following: (27)Q1=QT+Rb,p=Ra-Rb∗Ra-RbT-q=Ra∗RaT-2Ra∗RbT+Rb∗RbT-q,s=P1+Q1∗P1+Q1T+2Rb∗QT-2Rb∗P1T-q+v=P1∗P1T+P1∗Q1T+Q1∗P1T+Q1∗Q1T+2Rb∗QT-2Rb∗P1T-q+v=P1∗P1T-2P1∗QT+Rb∗RbT+Q∗QT-q+v.The expressions of p and s can be altered as follows:(28)p=-2Ra∗RbT+Rb∗RbT-q,s=-2P1∗QT+Rb∗RbT+Q∗QT-q+v.These values are related to Node B’s inputs, Q and Rb. For the convenience of measurement of privacy, the expressions of all three elements can be changed as follows:(29)Q1=In∗QT+In∗RbT+0∗Rb∗RbT+0∗Q∗QT+0∗q+0∗v,p=01∗n∗QT-2Ra∗RbT+Rb∗RbT+0∗Q∗QT+0∗q+0∗v,s1=-2P1∗QT+01∗n∗RbT+Rb∗RbT+Q∗QT-q+v.Here, it is supposed that(30)A1=InIn000001∗n-2Ra10-10-2P101∗n11-11,Z1=QTRbRb∗RbTQ∗QTqv,C1=Q1Tps.This satisfies A1∗Z1=C1 (In represents identity matrix). C1 is equivalent to msgT=s,p,Q1 and rank(A1) is n+2. If any participant obtains Q and msgT, he would easily calculate Rb, Rb∗RbT, q, Q∗QT, and v. According to the definitions given in Section 3.4, it can be concluded that H(Rb∣Q,msgT)=H(Rb∗RbT∣Q,msgT)=H(q∣Q,msgT)=HQ∗QTQ,msgT=H(v∣Q,msgT)=  0 and H(Q∣msgT)=H(Q,Rb,Rb∗RbT,Q∗QT,q,v∣msgT). According to Theorem 1, it can finally be deduced that H(Q∣msgT)=nlogp.Next, the degree of privacy is examined from Node B’s perspective. All messages received by Node B can be denoted withmsgH={q,P1}, where the following are true:(31)P1=In∗P+In∗Ra,q=Ra-Rb∗Ra-RbT-p=Ra∗RaT-2Rb∗RaT+Rb∗RbT-p.The expressions ofq and P1 can be altered into(32)P1=In∗P+In∗Ra+0∗Ra∗RaT-0∗p,q=01∗n∗P-2Rb∗RaT+Ra∗RaT-p.Here it is assumed that(33)A2=InIn0001∗n-2Rb1-1,Z2=PRaTRa∗RaTp,C2=P1q.This satisfies A2∗Z2=C2 (In represents identity matrix). Rank(A2) can be shown to be n+1 and C2 can be shown to be msgH. P and msgH allow Ra, Ra∗RaT, and p to be determined. In this way, it is obvious that H(Ra∣P,msgH)=H(Ra∗RaT∣P,msgH)=H(p∣P,msgH)=0, H(P∣msgH)=H(P,Ra,Ra∗RaT,p∣msgH), and H(P∣msgH)=((2n+1)-(n+1))logp=nlogp in terms of Theorem 1.Based on the information given above, the following conclusions can be drawn.Theorem 4.
The result of privacy measure for the TPEDP ismin(H(P∣msgH)/H(P), H(Q∣msgT)/H(Q∣msgT))=1, which implies perfect zero leakage.


## 7.2. The Repeated Calculation Problem of the REDP Protocol

Repeated calculation problem is worth emphasizing. It merits attention from both of the participants in the REDP protocol. An erroneous choice of participants may lead to a serious reduction in privacy. If Node A and Node B meet again after they have executed the REDP protocol at least once, then, during the new execution, the REDP protocol requires fresh initial vectors and random numbers distinguished from those used in the last calculation. A specific example can be cited and used to illustrate this issue, but discussions are not limited to this example.Node A and Node B, who held initial vectorsP and Q, respectively, have completed the REDP protocol once. To run the REDP again, Node B here reselects the initial vector R substituted for Q, but Node A insists on keeping the original vector P and updates the random sequence rai (i=0,1,2,…,n) and random numbers w and e to construct new P1, P2, and λ values. This indicates that Node B may encounter a group of 2n nonlinear polynomial equations when it receives those renewed data from Node A. If the new equations in the group are linearly independent from those obtained by Node B in the last execution (Node A held P and Node B held Q), then Node B can obtain a group of 4n nonlinear polynomial equations and 2n+3+n+3=3n+6 unknown quantities. If Node A selects ra0=1, e=1 in the new interaction (though this case is almost impossible), the 4n nonlinear polynomial equations will degenerate into a group of nonhomogeneous linear equations with 3n+6 unknown quantities. In this case, if n<6 (i.e., 4n<3n+6), then Node B cannot learn the value of P because of prohibitively high number of solutions. If n≥6 (i.e., 4n≥3n+6) and the number of unknown quantities is less than the number of equations, then Node B will break P and the location information of Node A is revealed. In this way, if Node A persists in using its original vector, it will be unable to update random sequences and random numbers (such as rai, w, and e) in another running of this protocol. Otherwise, Node B will collect more equations regarding this original vector of Node A, which will increase the risk of loss of privacy. However, in this case, Node A can change the random value of u to produce the corresponding alteration of the results fa and fb.For this reason, extra limitations must be added to the REDP protocol when it is encoded into the wireless communication devices. This can prevent some extreme situations such as selectingra0=1, e=1 in Node A’s computation round. Certainly, a better provision for the REDP protocol is that each participant should try to choose inputs different from those in previous executions to prevent hidden danger unless the location information of the participant has not changed. (This case has a negligible probability for moving entities.) In this way, Node A must only renew the values of u or v.


## 7.3. Availability in Wireless Sensor Networks

It is necessary to verify the availability of TPEDP and REDP in wireless sensor networks. We design such simulation experiments related to distance to observe the changes of network lifetime and energy consumption in the following three scenarios: the first is calculating the distance between Nodes A and B which use the REDP protocol; the second aids TPEDP to achieve the distance calculation (the current cluster-header is “TP”); and the third is based on ECC (elliptic curves cryptography), which is considered as the most lightweight public key method in WSNs, to realize the computation through encryptions, decryptions, and the reliable third party (the base station). To achieve the data-level privacy protection, in the third scenario, Nodes A and B must encrypt their locations separately using the public key of the base station, and the base station decrypts them and calculates the distance between Nodes A and B, and then the base station must encrypt the distance value by their respective public keys and send it to A and B. Finally, Nodes A and B decrypt it and obtain the result. If A and B cannot communicate with the base station within one hop, this method will cause heavy network loads.In order to ensure the validity of comparisons, we make some assumptions aimed at the three scenarios. Shown in Figure2, any two nodes who want to calculate the distance between them in the network can form a group; once a node joins one group it will not be able to join other groups, except the death of the other node in the same group, it will find a new single node with the same situation again to form a new group. In our simulation experiments, nodes would prefer to search the closest neighbor to form a group. All groups repeatedly calculate the distance between two members, until the network life cycle is ended. The base station, especially, does not participate in any group and all packets are in the same size which can be divided exactly by 16. Leach protocol will be used as the clustering and routing protocol in order to ensure path accessibility. If one current cluster-header is dead, it will reselect the new header in terms of Leach protocol. In TPEDP protocol, the same cluster-header can act as the TP for several groups of nodes. Detailed simulation parameters can be shown in Table 2.Table 2
Simulation parameters setting.
Parameters
The setting value
Network range
400 *   400 m2
Distribution of sensor nodes
Uniform distribution with the number from 100 to 400 nodes, and the base station is in the center
Clustering and routing protocol
Leach
The number of dimensions of location information
n
=
3, n=8
Original energy of node
20 J (infinite energy for the base station)
Energy consumption when sending a packet (at mostd = 128 bits)
0.35 J
Energy consumption when receiving a packet (at mostd = 128 bits)
0.15 J
Energy consumption when processing one bit (at mostd = 128 bits)
0.0005 J
Energy consumption when encrypting or decrypting one bit with ECC (at mostd = 128 bits)
0.0005 J
Energy consumption when processing a modular multiplication (modular operatorN2) (at most d = 128 bits)
0.001 J
Communication radius of node
50 m
Modular operatorN2
N
=
79, N2=6241Figure 2
Three simulation scenarios.We set two cases “n=3, d=64 bits” and “n=8, d=96 bits” to reflect the trend of network lifetime, based on the comparisons of REDP, TPEDP, and ECC, seen in Figures 3(a) and 3(b), respectively. We can watch that, with the increase of sensor nodes, the network lifetimes of three scenarios (or protocols?) appear to decline (or downtrend?) after a little growth in the initial stage. There exit different reasons of these phenomena for REDP, TPEDP, and ECC. There still exit some active sensor nodes in REDP (or TPEDP) because they cannot find another neighbor (or a suitable TP) in their communication ranges when the number of nodes is 100; however the lifecycle is terminated. With the increase of sensor nodes, the above symptoms will be relieved; for instance, the number of nodes is 150 or 200. With the further raise of the number of nodes (350 or 400), more and more new groups emerge while some previous groups are still running, which causes more communication costs, so the lifetime is shortened. Owing to direct or multihop communication to the base station for each node in the network, the secure distance calculation based on ECC would lead to more energy consumption, compared with REDP and TPEDP. Similarly, 100 nodes are uniformly distributed in 400 ∗ 400 field, however some active nodes have never been able to establish the paths to the base station before their lifecycles end. The suitable enhancement of sensor nodes would create more paths to the base station, which can prolong the network lifetime. However, when the number of nodes is 250 or more, many nodes will play the role of relay to achieve more paths, which causes the decline of lifecycle because of more energy consumption. It is worthy to notice that parameters n and d make have influence on the lifetime of REDP and TPEDP, which in Figure 3(b) is less than Figure 3(a), and the larger the n and d, the more the computation cost of the two protocols. However, the increase of the values of n and d cannot affect the decline of ECC too much, even if it also brings more computational overhead. Compared with TPEDP, REDP causes more energy consumption because of the requirements for more communication rounds and the cost of reselection of new cluster-headers for TP.Figure 3
Comparisons of network lifetime among REDP, TPEDP, and ECC.
(a)
(b)


## 7.4. Extended Multiparty Computation

The flexibility characteristics of the TPEDP and REDP protocols make them conveniently transform from two-party distance computation to multi-party distance computation. We suppose that there are totallym nodes in WSNs, and they can be denoted by U1,U2,…,Um and hold their secret inputs P1,P2,…,Pm, respectively, where P1=p11,p12,…,p1n,…,Pm={pm1,pm2,…,pmn} are all n-dimensional vectors. In a security multiparty distance protocol, any one of the nodes Ui (i=1,2,…,m) expects that it can achieve the correct distance value with any other node Uj (j=1,2,…,m & i≠j) without release of its secret; however Ui cannot obtain any privacy from Uj. So the output phase can be described as follows: f(Ui,Uj) is the final result that denotes Euclidean distance UiUj2, Ui grasps fUi, and Uj keeps fUj. Equation (4) shows the relationship among those symbols: (34)fUi=fUi,Uj+fUj.At last, Ui declares fUi and Uj reveals fUj, and they share the resulting f(Ui,Uj) according to (34).The details of calculation are determined by the specific protocol. IfU1,U2,…,Um select their respective random number denoted by θ1,θ2,…,θm in the calculation procedure, θi=UiUj2+θj can be used to represent the final result that keeps the same form of (34). For example, another participant (holds vector R and random number r) other than Node A and Node B can easily enjoy the implement of the two proposed protocols, which need to be upgraded simply, and the results would be shared by the form of u=PQ2+v, u=PR2+r and v=QR2+r.


## 8. Conclusions

Wireless sensor networks make communication and computation between humans and other things become a research hotspot. Two novel secure two-party protocols for distance computation are presented in this paper, designed to address the scenarios of privacy-preservation of location information in an encounter between Node A and Node B. The first proposed protocol, the TPEDP, involves a semihonest TP that protects the location of all participants from a passive attacker inside or outside the network. The problem of nonexistence of a suitable TP in wireless sensor networks was considered. The second protocol lacks a third party. The REDP, which benefits from randomization method, can be used to acquire the correct results of distance between two nodes securely. Compared to the similar protocols, the two proposals, TPEDP and REDP, performed more satisfactorily on the efficiency including rounds of communication, computation, and data type.However, the assumption of the semihonest model is only suitable for certain scenarios, those that can resist only passive attacks. Some protocols secure against the malicious adversary model have been proposed especially for privacy-preserving data applications [20, 25]. However, these techniques are expensive in both communication and computation costs. In the future, the design of efficient protocols that can resist active or malicious attacks may remain challenging.



---

*Source: 475150-2015-07-02.xml*