# Grouping Sensors for the Key Distribution of Implicit Certificates in Wireless Sensor Networks
## 3 The Proposed Methods
The node with the lowest depth is delegated as the root of the group, and the search restarts from the deepest node to its child node. This process continues until all sensor nodes are assigned to a group, and all groups can connect with other groups via a shared node. For the previous example, ABG can divide the entire network into nine groups. The grouping results are shown in Figure 8.  
According to the grouping results obtained in the earlier phase, each node in each group is assigned to a corresponding group key parameter by BS. The group key parameter of each node is composed of the key partitions of other nodes in the same group. Specifically, the group key parameter \(g_{pi}\) for node \(i\) is calculated from Equation (5), where \(k_{pi}\) represents  
Figure 4: Grouping results of the TDG algorithm. the key partition of the node, and \(m\) and \(N\) are the total number of sensor nodes in the group and the entire network, respectively. Then, the group key GK is calculated from Equation (6). \[x^{k}+a_{k-1}x^{k-1}+a_{k-2}x^{k-2}+\ldots+a_{1}x+d=0, \tag{1}\]0  
\[x^{k}+a_{k-1}x^{k-1}+a_{k-2}x^{k-2}+\ldots+a_{1}x+d=0, \tag{1}\]1  
Since the group key parameters and partitions may not be altered frequently, the last random number \(r\) is generated and used in each user request to change the group key, thus enhancing the security level for the entire system. Therefore, nodes residing in the same group will obtain the same GK by referencing the corresponding key partitions, group key parameters, and a random number. To sustain the WSN operation, the actions of removing and inserting some sensor nodes in the network are unavoidable. For example, a node must be replaced when it runs out of power. This alters the network topology; thus, the network grouping and group key parameters must be adjusted. This phase is out of the scope of this study; thus, no further details are provided. \[x^{k}+a_{k-1}x^{k-1}+a_{k-2}x^{k-2}+\ldots+a_{1}x+d=0, \tag{1}\]2 Pseudocode of the bottom-up grouping (BUG) algorithm. When completing the above grouping processes, secure communication channels are established for the entire WSN. Each sensor node senses, encrypts, and transmits data to its parent nodes. The data aggregator decrypts all received data, performs the data aggregation function, re-encrypts the aggregation result, and delivers it to the parent nodes. The boundary node in charge of inter-group communications decrypts the received data using the same group key and encrypts them using the key of the group to which the data are delivered. We can change only the random number and leave the rest unchanged to relieve the work on the generation of key partitions and group key parameters for BS to update or alter group keys. If higher security is required, changing the random number during a shorter period is a convenient way to update group keys frequently. We propose a group-based key distribution mechanism, symmetric encryption systems, and hash functions for encryption and the verification of transmitted data. We summarize the common security requirements and explain how these requirements are met by our mechanisms:  
1. Confidentiality: Provide a secure and confidential channel for wireless network communication to prevent eavesdropping. We use secret-sharing techniques to divide the group key into \"n\" shares, which also corresponds to the number of nodes. These shares are used to generate a group key required for symmetric data encryption. 2. Integrity: Verify that the message has not been altered during transmission. Each node and base station stores a one-way hash function. Before data transmission, the node hashes the data, and the receiving end verifies data integrity using the same  
\[x^{k}+a_{k-1}x^{k-1}+a_{k-2}x^{k-2}+\ldots+a_{1}x+d=0, \tag{1}\]3 Grouping results of the BUG algorithm. hash function. If the node loses a message, it can send a request to the base station to retransmit the message. 3.