A Key Management Scheme Based on Pairing-Free Identity Based Digital Signature Algorithm for Heterogeneous Wireless Sensor Networks

The secure transmission of data within a network has received great attention. As the core of the security management mechanism, the key management scheme design needs further research. In view of the safety and energy consumption problems in recent papers, we propose a key management scheme based on the pairing-free identity based digital signature (PF-IBS) algorithm for heterogeneous wireless sensor networks (HWSNs). Our scheme uses the PF-IBS algorithm to complete message authentication, which is safer and more energy efficient than some recent schemes. Moreover, we use the base station (BS) as the processing center for the huge data in the network, thereby saving network energy consumption and improving the network life cycle. Finally, we indirectly prevent the attacker from capturing relay nodes that upload data between clusters in the network (some cluster head nodes cannot communicate directly). Through performance evaluation, the scheme we proposed reasonably sacrifices part of the storage space in exchange for entire network security while saving energy consumption.


1.
Our scheme uses the pairing-free identity based digital signature (PF-IBS) algorithm to complete identity authentication. This algorithm not only ensures the security of the key establishment process, but also saves energy.

2.
We adopted a new network model. The energy consumption of generating the network routing structure is borne by the base station (BS), which saves a lot of computing costs for the internal network nodes. 3.
We protect the location privacy information of nodes in the network to prevent attackers from discovering and attacking relay nodes in the network.
The rest of the paper is organized as follows: Section 2 reviews some guiding key management schemes. Section 3 explains the proposed key management scheme for HWSNs. Section 4 evaluates the performance of the proposed scheme. Section 5 summarizes our paper.

Related Works
Du et al. [11] designed a distributed key management scheme combining a routing structure and ECC based on the scheme [12]. This scheme proposes the concept of a communication neighbor (c-neighbor), that is, the node only needs to establish the communication key with the c-neighbor node instead of establishing the communication key with all neighbor nodes. However, in order to obtain a c-neighbor relationship, the low-performance sensor (L-sensor) must upload its own location information to the high-performance sensor (H-sensor). The H-sensor generates an intra-cluster routing structure based on the collected location information of the L-sensor, and then distributes neighbor information for each L-sensor in the cluster. The advantage of this scheme is that the key establishment process combined with the routing structure can omit some unnecessary communication link establishment, thereby saving the computational cost and communication cost of the network; however, the disadvantage is that the communication load of the H-sensor is too large and takes up a lot of storage space. At the same time, the node lacks message authentication during the key establishment process.
Boujelben et al. [13] proposed an identity based key management scheme for heterogeneous sensor networks. This scheme assumes that each node knows the identity identifiers of all neighboring nodes in advance. Bilinear pairing based on identity cryptography (IBC) is used to assist in establishing the session key. For two nodes (say N i and N j ) that want to establish a session key K ij , each node first uses its own private key and the other's public key and combines the properties of bilinear mapping to generate a common key V ij . Then, they use V ij to encrypt the message (r i P or r j P) sent to the other party to generate a message authentication code, and send the message authentication code and message to the other party. Finally, when the message sent by the other party is verified, they use the Diffie-Hellman key exchange algorithm [14] to generate K ij . The advantage of this scheme is better security and less key storage occupancy. The disadvantage is that the key establishment process only has message authentication and no identity authentication, and the key establishment process consumes more energy.
Wang et al. [15] proposed a distributed key management scheme that makes communication links more secure. In this scheme, Wang et al. have taken some improvement measures to address the two issues in the scheme [11]. Wang et al. used an energy-aware routing protocol to improve the first problem. For the second problem, the identity-based encryption (IBE) algorithm is used for message authentication. The advantage of the scheme is that it achieves better security through message authentication during the key establishment process. At the same time, the energy-aware routing algorithm [16] is used to save network energy consumption. The disadvantage of the scheme is that using the IBE algorithm to complete message authentication will consume a lot of energy. At the same time, the message authentication process cannot defend against replay attacks.
Harbi et al. [17] proposed a key management scheme that can ensure network data transmission security by enhancing authentication during key establishment. The scheme found that the Inter-Cluster Multiple Key Distribution Scheme for Wireless Sensor Network (ICMDS) [18] has the problem where it cannot implement the calculation of the session key. After reviewing the design process of the ICMDS scheme, Habib et al. found that the master private key needed to establish the key was lacking. In response to the problem of the ICMDS scheme, Habib et al. designed a new key management scheme based on the identity-based encryption (IBE) algorithm. The advantage of this scheme is that it can resist multiple types of attacks. However, the disadvantage of this scheme is that once the master private key is known by the attacker, all session keys established within the network will be exposed. In addition, completing identity authentication will consume a lot of energy.
Through the analysis of the above schemes, we know that ensuring the security of the designed key management scheme has always been the focus of attention. However, the security problems of key management schemes still exist. Even though security can be guaranteed in some ways, it comes at the expense of energy consumption. At the same time, we learn that identity-based security mechanisms have also received great attention from researchers.

PF-IBS Algorithm
We optimize the PF-IBS algorithm proposed by Sharma et al. [19] The public key of each node in our optimized PF-IBS algorithm is related to ID i , which is more conducive to identity authentication. Its security depends on the intractability of the discrete logarithm on the elliptic curve. Its implementation requires the following four steps: Setup: PKG selects a safe elliptic curve E/F p over the finite field F p : y 2 = x 3 + ax + b, where a, b ∈ F p and ∆ = 4a 3 + 27b 2 0. E/F p satisfying ∆ = 4a 3 + 27b 2 0 is a non-singular hyperelliptic curve, which is suitable for cryptographic applications. E F p consists of points on an elliptic curve and points of infinity and constitutes a group. P ∈ E F p as the generator of G.
(1) PKG selects s ∈ Z * q as the master private key and obtains the master public key P pub = sP.
(2) PKG selects two hash functions: where l ID i represents the length of ID i and l m represents the length of the message m.
(1) PKG selects r ID i ∈ Z * q , and calculates R ID i = r ID i ·Pandc ID i = H 1 (ID i R ID i ) , where c ID i is the public key of each node. (2) PKG calculates d ID i = r ID i + c ID i s mod q, where R ID i , d ID i is the private key of the node.
PKG preloads R ID i , d ID i and π correspondingly into each node.

Sign:
Taking nodes u and v as an example, u signs the message m u with its private key (R u , d u ) and sends ID u , m u , and the signed message σ u to v.
(1) u chooses a random number ϕ u ∈ Z * q , calculates E u = ϕ u ·P first, and then calculates h u = H 2 (m u , ID u , R u ) and Z u = ϕ u + h u ·d u mod q. (2) u generates σ u = (E u , R u , Z u ).
Verify: v uses the received ID u to verify σ u sent by u.
(2) v determines whether the left and right sides of Z u ·P = E u + h u · R u + c u P pub are equal. If two sides are equal, m u and identity authentication pass, and vice versa.

Network Assumptions
Our network model includes a powerful BS, a few high-performance sensors (H-sensors), and many low-performance sensors (L-sensors). According to the needs of the network architecture, each H-sensor in the network will be used as the cluster head (CH). We have listed some assumptions about the network model:

Network Communication Mode
Our network model draws on three communication modes used in LEAP+ [20]: • Unicast (the process by which a particular node sends a message to a single node).

•
Local broadcast (the process by which a particular node sends a message to all neighbor nodes within its communication range).

•
Global broadcast (the process by which a particular node sends a message to all nodes in the network).

Data Preloading of Network Nodes
Based on the above assumptions that the BS is trusted and protected, we use the BS to act as a PKG role. The BS uses π and s in combination with ID L i to generate each L-sensor's identity-based public key c L i and private key (R L i , d L i ). The same operation process for the identity identifiers ID H i of each H-sensor and ID BS of the BS can generate c H i , (R H i , d H i ), and c BS , (R BS , d BS ) for them. The asymmetric pair keys of all L-sensors are denoted by c L s and (R L s , d L s ), respectively. Similar expression methods, c H s and (R H s , d H s ), will be used to represent the public and private keys of all H-sensors. Each L-sensor is preloaded with π, ID BS , c BS , represents the public keys of the ECC encryption algorithm [21] for all H-sensors and K R L i represents the private key of the ECC encryption algorithm for each L-sensor. Each H-sensor will preload π, ID BS , c BS , is the private key of the ECC encryption algorithm of each H-sensor and K H is used for communication between H-sensors (and BS). The BS is preloaded with s, π, represents the public keys of the ECC encryption algorithm for all L-sensors.

Routing Structure Generation
In HWSNs, the routing structure consists of two parts: Intra-cluster routing and inter-cluster routing. The former means that the intra-cluster L-sensor uploads the collected perceptual data to the nearest CH through the shortest path algorithm. The latter refers to the routing protocol where the CH uploads the collected sensory data to the BS according to the shortest path algorithm. We apply wireless sensor networks to military environmental monitoring. It is assumed that the surveillance area is a square area of 1000 m × 1000 m, and a trusted and protected BS is established in the center of the area in advance. Please note that our scheme does not restrict the BS to the regional center, but the communication range of the BS must cover the area. Then, a military aircraft randomly and uniformly spreads 20 H-sensors and 980 L-sensors in the surveillance area. Each L-sensor (and H-sensor) can obtain its own location through some sort of location service (such as [22,23]). Considering that the energy consumption and cost of GPS are not suitable for WSNs, we do not use the GPS location service.
In our scheme, the routing structure design within the network requires the BS to collect the location information of nodes in the entire network in advance. First, the BS broadcasts the invitation-join message (including ID BS and timestamp T BS ) to all nodes in the network by means of global broadcast. Then, once the H-sensor receives the invitation-join message, each H-sensor (say H 1 ) will locally broadcast a Hello message (including ID H 1 and timestamp T H 1 ). Each L-sensor determines which H-sensor it belongs to by analyzing the signal strength of the received Hello message. (We assume that some L-sensors choose H 1 as the CH). Take u in these L-sensors as an example. u uploads its join-reply message (including ID u , location information l u , timestamp T u , and digital signature σ u ). What we need to pay attention to is that l u needs to encrypt with K U H 1 . Finally, after H 1 receives σ u , it uses the ID u preloaded to verify σ u . Other nodes perform similar operations. H 1 encrypts the encrypted join-reply messages of these L-sensors with K H and uploads them to BS. In Figure 1, we show a system model diagram of the entire network routing structure design.
Although the nodes in this area are randomly and evenly distributed, there is no guarantee that some communication nodes must be within their own communication range. Therefore, there are two problems in the process of uploading join-reply messages to the BS in the network: (1) Some special L-sensors may not receive Hello messages broadcast by H-sensors. (2) There may be special H-sensors that cannot communicate directly with all surrounding H-sensors, resulting in an interrupt to upload the join-reply messages. Although the nodes in this area are randomly and evenly distributed, there is no guarantee that some communication nodes must be within their own communication range. Therefore, there are two problems in the process of uploading join-reply messages to the BS in the network: 1) Some special L-sensors may not receive Hello messages broadcast by H-sensors. 2) There may be special H-sensors that cannot communicate directly with all surrounding H-sensors, resulting in an interrupt to upload the join-reply messages.
In order to prevent some L-sensors in the network from becoming isolated nodes because they cannot receive Hello messages from H-sensors, we use the surrounding L-sensors to help these Lsensors complete the join-reply message upload. When there is no direct communication between Hsensors, we select some relay L-sensors between H-sensors to complete the upload of the join-reply messages. The specific solutions to these two problems are as follows: For the first problem, the BS can notify all L-sensors (including these special L-sensors) through global broadcast. After receiving the invitation-join message, these special L-sensors through local broadcast send their own join-reply messages to the L-sensor that can receive the H-sensor signal strength, and they then use the L-sensor to indirectly upload their own join-reply messages to the Hsensor. For the second problem, these special H-sensors (say H 1 ) first decrypt the join-reply messages of these L-sensors with K 1 and then find the appropriate relay nodes by the position information of these L-sensors. The nodes in our scheme are randomly deployed, so CH can only find some relay nodes from the location information of the collected L-sensors. This is different from some schemes (such as [24,25]) using manual deployment of relay nodes to enhance network connectivity. Finally, H 1 can indirectly upload the collected join-reply messages (encrypted with K ) of these L-sensors to the surrounding H-sensors by means of relay nodes. The BS will receive join-reply messages of all Lsensors. After completing the message collection, the BS generates a network routing structure using the location information of all L-sensors in combination with the shortest path algorithm.
The BS determines the communication neighbor relationship between nodes according to the network routing structure. Next, the BS can help the node establish a session key according to the communication neighbor relationship of the nodes in the network. In Table 1, we describe some security measures identifiers. In Figure 2, we visually demonstrate the process by which the L-sensor in the network uploads its own location information to the BS. In order to prevent some L-sensors in the network from becoming isolated nodes because they cannot receive Hello messages from H-sensors, we use the surrounding L-sensors to help these L-sensors complete the join-reply message upload. When there is no direct communication between H-sensors, we select some relay L-sensors between H-sensors to complete the upload of the join-reply messages. The specific solutions to these two problems are as follows: For the first problem, the BS can notify all L-sensors (including these special L-sensors) through global broadcast. After receiving the invitation-join message, these special L-sensors through local broadcast send their own join-reply messages to the L-sensor that can receive the H-sensor signal strength, and they then use the L-sensor to indirectly upload their own join-reply messages to the H-sensor. For the second problem, these special H-sensors (say H 1 ) first decrypt the join-reply messages of these L-sensors with K R H 1 and then find the appropriate relay nodes by the position information of these L-sensors. The nodes in our scheme are randomly deployed, so CH can only find some relay nodes from the location information of the collected L-sensors. This is different from some schemes (such as [24,25]) using manual deployment of relay nodes to enhance network connectivity. Finally, H 1 can indirectly upload the collected join-reply messages (encrypted with K H ) of these L-sensors to the surrounding H-sensors by means of relay nodes. The BS will receive join-reply messages of all L-sensors. After completing the message collection, the BS generates a network routing structure using the location information of all L-sensors in combination with the shortest path algorithm.
The BS determines the communication neighbor relationship between nodes according to the network routing structure. Next, the BS can help the node establish a session key according to the communication neighbor relationship of the nodes in the network. In Table 1, we describe some security measures identifiers. In Figure 2, we visually demonstrate the process by which the L-sensor in the network uploads its own location information to the BS.

Centralized Session Key Establishment
It is assumed that the L-sensor (say , ) will be determined to be the communication neighbor node relationship. The BS first generates a session key K for and through a pseudo-random function. Then, K is encrypted by and K , respectively. Finally, the encrypted K is digitally signed with (R , d ) to obtain σ . The BS sends σ to and by unicast. When the two nodes

Centralized Session Key Establishment
It is assumed that the L-sensor (say u, v) will be determined to be the communication neighbor node relationship. The BS first generates a session key K uv for u and v through a pseudo-random function. Then, K uv is encrypted by K U u and K U v , respectively. Finally, the encrypted K uv is digitally signed with (R BS , d BS ) to obtain σ BS . The BS sends σ BS to u and v by unicast. When the two nodes receive σ BS , they use the preloaded c BS to perform digital signature verification and then use their own K R u and K R v to decrypt and obtain K uv , respectively.

Distributed Session Key Establishment
The assumption of the communication neighbor node relationship is consistent with the above. The BS first encrypts the routing materials of u and v with K U u and K U v , respectively. Then, the BS digitally signs the encrypted routing material with (R BS , d BS ) to obtain σ BS . Finally, the BS sends σ BS to u and v by unicast, respectively. When the two nodes receive σ BS , they use the preloaded c BS to perform digital signature verification and then use their own K R u and K R v , respectively, to decrypt and obtain their own routing materials.
The routing material of each L-sensor includes the ID i and c L i of its optimal communication neighbor node and the ID j and c L j of the backup communication neighbor node (relay nodes may contain IDs of multiple backup communication neighbor nodes). In the early stage, the optimal neighbor node will be the first object to establish the session key. However, the process of establishing session keys between nodes requires authentication to prevent some attacks (such as [26]). Taking nodes u and v as examples, combining the principle of the PF-IBS algorithm, the key establishment process of K uv requires the following five steps: STEP 1: u selects ϕ u , r u ∈ R Z q * , calculates E u = ϕ u P first, and then calculates h u = H 2 (m u , ID u , R u ) and Z u = ϕ u + h u d u mod q, where m u = r u P. Finally, u sends ID u , E u , R u , Z u , m u , T u to v. STEP 2: After obtaining the message from u, v first determines if T u is valid, and, if it expires, rejects the message. It is determined whether ID u is consistent with the ID u distributed by BS. If the confirmation is consistent, then u is a communication neighbor node. Next, v calculates h u = H 2 (m u , ID u , R u ) and determines whether the left and right sides of Z u P = E u + h u R u + c u P pub are equal. If the two sides are equal, m u and identity authentication pass, and vice versa. It should be noted that the BS has assigned the public key c u of u to v.
STEP 4: After obtaining the message from v, u first determines if T v is valid, and, if it expires, rejects the message. It is determined whether ID v is consistent with the ID v distributed by BS. If the confirmation is consistent, then v is a communication neighbor node. Next, u calculates h v = H 2 (m v , ID v , R v ) and determines whether the left and right sides of Z v P = E v + h v R v + c v P pub are equal. If the two sides are equal, m v and identity authentication pass, and vice versa.
STEP 5: u and v respectively generate a shared key K uv = r u ·r v P = r v ·r u P = K vu .

New Node Key Establishment and Old Key Deletion
In order to achieve the shortest path for the L-sensor to upload data, some L-sensors in the routing structure will be the optimal communication neighbor node of multiple L-sensors. There may be some L-sensors that act as relay nodes for inter-cluster data uploading. These optimal communication neighbor nodes and relay nodes undertake too many data upload tasks. They die prematurely due to excessive energy expenditure. There are even some L-sensors that are captured by the attacker. The death or capture of certain nodes can result in severe network partitioning, which prevents uploading of collected data. In order to extend the network life cycle, we need to revoke them and add new L-sensors. We assume that there is a detection mechanism (such as [27,28]) in the network to screen out death or captured nodes in the network. The BS notifies all L-sensors in the network about the IDs of these nodes by means of global broadcast. All L-sensors will check the IDs of their communication neighbor nodes. If IDs of these nodes are found, the L-sensor will delete IDs of these nodes and the previously established shared keys. When adding some new nodes to a certain area, the BS first encrypts the ID i of the new node with the c L j of the specific node of the area. Then, it uses (R BS , d BS ) to digitally sign the encrypted message to obtain σ BS . Finally, it sends the σ BS to the specific node in the area by unicast, and these specific nodes will obtain IDs of new nodes. The new node (preloading IDs of the specific node) uses the above-mentioned distributed key establishment method to complete key establishment between the specific node and the new node.

Routing Update
In our scheme, the BS periodically informs nodes in the network to upload their remaining energy values. After obtaining the remaining energy values of all nodes, the BS will update the routing structure according to the remaining energy value of the node and the path energy consumption values. Next, according to the new routing table, the BS notifies the L-sensor to update the communication neighbor by unicast and completes the new session keys establishment.

The Comparison of Key Storage Cost
In [11], Du et al. assume that in HWSNs, the number of H-sensors and L-sensors is M and N, respectively, and satisfies M << N. The following other schemes have the same assumptions on the number of nodes. In this scheme, each L-sensor (such as u) preloads its own private key and CH's public key. Each H-sensor preloads its own private key, u's public key, and key K H . The number of keys preloaded by Du et al.'s scheme is (1) In [13], Boujelben et al. adopted a pairing idea of bilinear mapping during the key establishment process to assist the node in completing the session key establishment. This scheme has the smallest key storage space occupation. Each H-sensor and each L-sensor only need to store its own private key preloaded by the key distribution center. The number of keys preloaded by Boujelben et al.'s scheme is (2) In [15], according to the design process of Wang et al.'s scheme, each L-sensor only preloads its own private key d L i . Each H-sensor only preloads its own private key d H i and K H . Thus, in the scheme of Wang et al., the number of keys preloaded is In [17], Harbi et al. designed a layered sensor network key management scheme. As can be seen from the node initialization phase of the scheme, each L-sensor also preloads a master private key k and the BS's public key Pu BS , and each H-sensor preloads a master private key k and the BS's public key Pu BS . In this scheme, the BS is considered a powerful device; therefore, all keys preloaded to the BS are negligible. The number of keys preloaded by Harbi et al.'s layered sensor network key management scheme is In our scheme, the BS preloads a lot of keys, which play a very important role. It should be emphasized that the BS has enough storage space; thus, all keys preloaded to the BS are negligible. In terms of preloading keys, our centralized key management scheme is the same as the distributed key management scheme. Each L-sensor is preloaded with , c L s , K H . In our scheme, the number of keys preloaded is In Table 2, we show the distribution ratio between the H-sensor and the L-sensor in HWSNs. Figure 3 shows the comparison of the above schemes in terms of key preloading.  In Figure 3, the total key storage cost is higher in our scheme, but the storage cost of a single Lsensor can withstand the number of preloaded keys. We assume that the length of a single key is 160 bits. We follow the configuration of the fifth set of nodes in Table 2. A single L-sensor needs 0.86 KB to store the preloaded keys and a single H-sensor needs 19.68 KB to store the preloaded keys. We know that MICA2 has 128 KB of storage space, so the L-sensor can withstand the number of preloaded keys. The storage space of a single H-sensor itself is larger than the storage space of a single L-sensor, so the H-sensor can withstand the number of preloaded keys. Our scheme occupies more total key storage space for several reasons: 1) In our scheme, each L-sensor does not know which Hsensor will manage it before deployment. Therefore, it is essential that each L-sensor preloads K in advance. K and K can be used to encrypt the location information of the protected node to prevent attackers from eavesdropping on the node's private information.
will be used to protect the session key or routing material of the L-sensor assigned by the BS. 2) In Wang's scheme, the scheme assumes that the L-sensor and the H-sensor in the cluster know the neighbors in advance. This indicates that the scheme is applicable to a network model in which the node knows the deployment knowledge rather than the randomly deployed network model, because randomly deployed nodes cannot know in advance which nodes are communication neighbors [29]. In order to obtain the deployment knowledge of the network model, our scheme needs to store to complete the digital signature authentication to obtain the routing structure from the BS. 3) We do not use the IBE algorithm to protect the L-sensor location information. Although this approach eliminates the need to preload K and K , the use of bilinear mapping operation in the IBE algorithm consumes more energy than the ECC encryption algorithm. Due to space limitations, we can refer to some papers [30,31] to understand the IBE algorithm.

The Comparison of Computation Cost
According to the HWSNs model we designed, we use MATLAB to simulate a cluster-generated routing structure to study. As the distribution of nodes in a single cluster is the same as the distribution of nodes in the entire network, in order to obtain the computing cost of the network In Figure 3, the total key storage cost is higher in our scheme, but the storage cost of a single L-sensor can withstand the number of preloaded keys. We assume that the length of a single key is 160 bits. We follow the configuration of the fifth set of nodes in Table 2. A single L-sensor needs 0.86 KB to store the preloaded keys and a single H-sensor needs 19.68 KB to store the preloaded keys. We know that MICA2 has 128 KB of storage space, so the L-sensor can withstand the number of preloaded keys. The storage space of a single H-sensor itself is larger than the storage space of a single L-sensor, so the H-sensor can withstand the number of preloaded keys. Our scheme occupies more total key storage space for several reasons: (1) In our scheme, each L-sensor does not know which H-sensor will manage it before deployment. Therefore, it is essential that each L-sensor preloads K U H s in advance. K U H s and K R H i can be used to encrypt the location information of the protected node to prevent attackers from eavesdropping on the node's private information. K R L i will be used to protect the session key or routing material of the L-sensor assigned by the BS. (2) In Wang's scheme, the scheme assumes that the L-sensor and the H-sensor in the cluster know the neighbors in advance. This indicates that the scheme is applicable to a network model in which the node knows the deployment knowledge rather than the randomly deployed network model, because randomly deployed nodes cannot know in advance which nodes are communication neighbors [29]. In order to obtain the deployment knowledge of the network model, our scheme needs to store c BS to complete the digital signature authentication to obtain the routing structure from the BS. (3) We do not use the IBE algorithm to protect the L-sensor location information. Although this approach eliminates the need to preload K U H s and K R H i , the use of bilinear mapping operation in the IBE algorithm consumes more energy than the ECC encryption algorithm. Due to space limitations, we can refer to some papers [30,31] to understand the IBE algorithm.

The Comparison of Computation Cost
According to the HWSNs model we designed, we use MATLAB to simulate a cluster-generated routing structure to study. As the distribution of nodes in a single cluster is the same as the distribution of nodes in the entire network, in order to obtain the computing cost of the network model faster, we take a single cluster as the research object. Figure 4 shows a routing structure diagram of nodes within a cluster in the case of a single cluster. In Figure 4, the cluster contains 1 H-sensor and 75 L-sensors.
Sensors 2020, 20, x FOR PEER REVIEW 11 of 15 model faster, we take a single cluster as the research object. Figure 4 shows a routing structure diagram of nodes within a cluster in the case of a single cluster. In Figure 4, the cluster contains 1 Hsensor and 75 L-sensors. To compare the computational costs, we use the paper [32] referenced by Harbi et al. to obtain some important calculation parameters. The acquisition of important calculation parameters in [32] is derived from the PBC library based on the GMP library. We adopt the same energy consumption comparison idea as the scheme [11,12,15], that is, we only consider the calculation cost of the key without considering the cost of data communication. Table 3 shows the time required for various calculation operations in the designed algorithm. Figure 5 shows the comparison of the energy consumed by our scheme with other schemes during the key establishment process.  To compare the computational costs, we use the paper [32] referenced by Harbi et al. to obtain some important calculation parameters. The acquisition of important calculation parameters in [32] is derived from the PBC library based on the GMP library. We adopt the same energy consumption comparison idea as the scheme [11,12,15], that is, we only consider the calculation cost of the key without considering the cost of data communication. Table 3 shows the time required for various calculation operations in the designed algorithm. Figure 5 shows the comparison of the energy consumed by our scheme with other schemes during the key establishment process.  In Figure 5, our scheme has a lower computational cost than schemes [13,15,17]. Du et al.'s scheme lacks location information protection and message authentication during the session key establishment process and, thus, has the lowest computational cost. However, its security is very poor. In order to improve the security of the established session key, the security authentication mechanism is very important, such as [33]. Our scheme has lower calculation costs for several reasons: 1) In our scheme, the public key of the communication neighbor node is pre-allocated by the BS, thereby saving the computational cost of the node performing the hash function operation on . 2) Our scheme uses the PF-IBS algorithm, which saves the computational cost of bilinear pairing operations.

Security Performance Discussion
• 1) Forward secrecy of master private key. Forward secrecy: The private key of one or more participating entities is compromised, but the established session key is not destroyed. In Harbi et al.'s scheme, once s is leaked, all session keys will be compromised, so the scheme does not have the forward secrecy of the master private key. However, in our scheme, even if s is leaked, it does not affect the shared key that has been established. • 2) Resist replay attacks. Replay attacks: The attacker misleads the legitimate node by resending the previous authentication code and synchronizing it to the wrong time.
In our scheme, the message forwarded by the node adds a timestamp, which ensures the freshness of the data and prevents the attacker from initiating replay attacks. • 3) Resist the node replication attack. Replication attack: The attacker captures the node and places a copy of it in multiple geographic locations to establish the illegal communication link with the legitimate node. There are some schemes (such as [34,35]) for preventing the node replication attacks. In our scheme, the BS pre- In Figure 5, our scheme has a lower computational cost than schemes [13,15,17]. Du et al.'s scheme lacks location information protection and message authentication during the session key establishment process and, thus, has the lowest computational cost. However, its security is very poor. In order to improve the security of the established session key, the security authentication mechanism is very important, such as [33]. Our scheme has lower calculation costs for several reasons: (1) In our scheme, the public key of the communication neighbor node is pre-allocated by the BS, thereby saving the computational cost of the node performing the hash function operation on G. (2) Our scheme uses the PF-IBS algorithm, which saves the computational cost of bilinear pairing operations.

•
(1) Forward secrecy of master private key. Forward secrecy: The private key of one or more participating entities is compromised, but the established session key is not destroyed. In Harbi et al.'s scheme, once s is leaked, all session keys will be compromised, so the scheme does not have the forward secrecy of the master private key. However, in our scheme, even if s is leaked, it does not affect the shared key that has been established. • (2) Resist replay attacks. Replay attacks: The attacker misleads the legitimate node by resending the previous authentication code and synchronizing it to the wrong time. In our scheme, the message forwarded by the node adds a timestamp, which ensures the freshness of the data and prevents the attacker from initiating replay attacks.

•
(3) Resist the node replication attack. Replication attack: The attacker captures the node and places a copy of it in multiple geographic locations to establish the illegal communication link with the legitimate node. There are some schemes (such as [34,35]) for preventing the node replication attacks. In our scheme, the BS pre-allocates information about the communication neighbor nodes of each node within the network. At the same time, we adopt the neighbor node authentication mechanism, and the legal node refuses to receive the information of the replica node, so it cannot pass the authentication and establish a secure communication link. Therefore, our scheme can effectively resist node replication attacks. • (4) Resisting node capture attack. Resilience: Probability of exposing keys of the uncaptured node when some nodes are captured. The lower the resilience value, the more difficult it is for an attacker to exploit the useful information of the captured node to attack legitimate nodes. Conversely, the more nodes the attacker captures, the more useful information will be obtained and the higher the resilience value. In our scheme, the attacker cannot obtain the key of the uncaptured node by the information of the captured node. • (5) Network weak area protection: Protection of relay node location information. Similar to the need to protect some important private information in our lives (such as [36,37]), we need to protect some important data information from being leaked. However, the location information protection of the node in our scheme is different from the privacy protection of the source nodes mentioned in the paper [38]. We know that the source node location privacy protection scheme for homogeneous WSNs has achieved some research results, but the source node location privacy protection scheme for heterogeneous wireless sensor networks has not been studied. However, the protection of the source node location privacy is not the focus of our scheme. Our scheme focuses on encrypting the location information uploaded by the L-sensor to prevent an attacker from obtaining a global routing table for the network. When an attacker obtains a global routing table, it is easy to find the location of the relay node. The number of these relay nodes is very limited. As the number of captured relay nodes increases, it will seriously affect the data upload in the network, and even lead to network partitioning. Our scheme prevents attackers from eavesdropping on the location information of the node of the network to generate a global routing table to find relay nodes. Table 4 shows the discussion of various schemes about security attacks.  Table 4 discusses the security performance of the various schemes. In order to ensure that the scheme is more secure, it is indispensable for the proposed scheme to incorporate a secure authentication process. Although the identity-based security mechanism has many advantages in the message authentication process, it is essential to ensure the security of the master private key. At the same time, when we make full use of the characteristics of the network model to design the scheme, we must pay attention to protecting the privacy information of the network nodes.

Conclusions
In this paper, we presented a key management scheme based on the PF-IBS algorithm for HWSNs. In our scheme, the BS acted as a data processing center to accomplish the tasks of routing structure generation, routing material allocation, and routing updates, thereby saving a lot of computational cost for the internal network. We used the PF-IBS algorithm to perform authentication. As the algorithm does not require bilinear pairing operations, it can save a lot of computational cost compared to other authentication schemes with bilinear pairing operations. Our scheme reasonably sacrificed some storage space, but ensured network security and saved energy. In the future, we will examine some of the problems faced by key management under new routing protocols and mobile node network models.