# A Novel Security Architecture for WSN-Based Applications in Smart Grid
## 1 Introduction
### Contribution  
To cope with the aforementioned limitations of centralized PKI, we propose in this research work a new distributed PKI for WSN-based applications in SG. The proposed distributed PKI is built on a clustering algorithm, where the cluster heads (CHs) will play the role of the CA in the clusters. We aim to improve the scalability of the PKI and enhance the availability of the certification process by delegating the role of the CA among CHs. So far, a large number of schemes have been put forward for PKI in WSNs. Two main approaches are adopted in the existing architectures: either the CA or trust authority is a centralized and permanent authority like in [7,8] or the role of the CA is distributed among a set of authorities nominated and preconfigured offline such as in [9,10]. Unfortunately, both approaches suffer from the single point of failure. In the perspective of avoiding this risk and improving the scalability and availability of the CA, in the proposed architecture, its role is delegated to a set of sensor nodes elected dynamically in the network, in so doing, if one CA is compromised, only its cluster will be affected, consequently, the single point of failure is solved. Furthermore, the election of the sensor nodes that will play the role of CAis achieved using a clustering algorithm. That is why, in this research work, we propose a new clustering algorithm for WSNs deployed in SG. It is based on many parameters, such as the energy level of the sensor nodes, the number of trustful neighbors, and the trust metric of the sensor nodes. A new clustering algorithm is proposed for many reasons. First, the large scale of WSNs in SG requires a lightweight and fast clustering process that does not require an excessive exchange of control messages to save the resources of the sensor nodes. Secondly, almost all clustering algorithms are based only on the location or the energy level, however, these two parameters are not sufficient to elect trustful CHs and balanced clusters. Additionally, since, in the proposed architecture, the cluster head will play the role of the certification authority in its cluster, this requires a high level of trustworthiness. That is why a trust metric is considered in the election process in addition to many others metrics like the energy level and the number of trustful neighbors. The latter will help in maintaining the stability of the architecture. If the CA is lost for any reason (compromise, energy,... ), its trustful neighbor will replace it. Furthermore, we aim to create balanced clusters to balance the load on the elected cluster heads. Although plenty of clustering algorithms exist in the literature, they provide a great many brilliant ideas but unfortunately, we did not find an algorithm that has all the aforementioned features. The key contribution of this article is summarized as follows:  
* A novel clustering algorithm is proposed to elect the CHs. Given the sensitivity of their role, many metrics are considered in the election process, particularly the trust metric of the sensor nodes and the number of trust neighbors. To balance the load on the CHs, the size of the cluster is also considered. * Then, a distributed PKI is designed where the CHs play the role of the certification authority in their clusters. In each cluster, a registration authority (RA) is responsible for checking the authenticity of the sensor nodes before being certified. * Afterward, the performance of the clustering algorithm and the robustness of the architecture is evaluated using simulation. The rest of the paper is organized as follows. In Section 2, we discuss the related work interested in security in WSN-based applications in SG. In Section 3, the related work of clustering protocols in WSNs is reviewed, also a comprehensive classification of the discussed approaches is presented. Section 4 proposes a new distributed PKI based on a clustering algorithm to address the limitations of the existing solutions. The simulation results are presented in Section 5.