This paper discusses security improvements in wireless sensor networks (WSNs) through an enhanced key management module, focusing on the Low Energy Adaptive Clustering Hierarchy (LEACH) protocol. It evaluates existing security modifications, such as Sec-LEACH, and proposes a new approach to key management that improves node-to-node and node-to-base station communications while managing resource limitations. The proposed technique aims to achieve higher security levels by utilizing various key types and ensuring secure communication within clusters of WSNs.