###### Abstract  
The rapid growth of technology has resulted in the deployment of a large number of interconnected devices, resulting in a wide range of new societal services. Wireless sensor networks (WSNs) are a promising technology which is faced with the challenges of operating a large number of sensor nodes, information gathering, data transmission, and providing a means to act in different scenarios such as monitoring, surveillance, forest fire detection, and many others from the civil to military spectrum. The deployment scenario, the nature of the sensor-equipped nodes, and their communication methods make this architecture extremely vulnerable to attacks, tampering, and manipulation than conventional networks. Therefore, an optimal solution to ensure security in such networks which captures the major constraints of the network in terms of energy utilization, secured data transmission, bandwidth, and memory fingerprint to process data is required. This work proposes a fast, reliable, and secure method of key distribution and management that can be used to ensure the integrity of wireless sensor networks' communications. Moreover, with regards to efficient energy utilization, an improvement of the Low Energy Adaptive Clustering Hierarchy (LEACH) algorithm (a cluster routing protocol that is mainly used in WSN) has been proposed to enhance the networks' energy efficiency, simplicity, and load-balancing features. Therefore, in this paper, we propose a combination of a distributed key exchange and management methods based on elliptic curve cryptography to ensure security of node communication and an improved routing protocol based on the LEACH protocol to demonstrate better performance in parameters such as network lifespan, dead nodes, and energy consumption. W 2022 202  
Meanwhile several methods, and protocols have been suggested, primarily concerned with reducing energy consumption and increasing the network lifetime [4; 5]. Two of the major challenges in WSN are security and energy management. WSNs consist of a large number of sensor nodes which are highly decentralized and deployed in a difficult environment with unreliable channels of communication. As a result of the complexity and interconnection of a wide range of devices and protocols, as well as the variety of routing protocols and services available, it is extremely difficult to apply IT network solutions in WSNs. Hence, most of the current security mechanisms in use are either insufficient or incompatible. Many techniques and trends have been used to achieve a certain range of security levels, such as trust management and encryption techniques using lightweight methods to have low-cost encryption for low-power and constrained devices. Routing protocols may also be vulnerable to serious attacks, such as the introduction of false or malicious routing information into a network, causing delays or packet losses due to routing conflicts. Many solutions have been proposed to avoid routing attacks such as encryption and information correlation between multiple nodes [6]. Cryptographic methods are then proposed to ensure security, but due to the constraints of the devices, such as energy and memory capacity, only a lightweight encryption technique might be applied. These algorithms can be implemented in software or in hardware using an integrated circuit (IC). Each of these solutions incurs an additional expense for the sensor node manufacturer since they both require the use of additional resources. Moreover, wireless sensor nodes are firmly restricted in relation to transmission energy, bandwidth, capacity, storage, and on-board energy. Due to such dissimilarities, a number of new routing protocols have been proposed in order to cope with these routing challenges in wireless sensor networks. Wireless sensor networks are mostly battery-powered. An energy shortage is a major issue in these sensor networks especially in harsh and unfriendly terrains.