Nowadays, Wireless Sensor Networks are a hot research topic in the scientific community. Researchers seek to maximize their autonomy while paying attention to their limited resources, few computing capacity and low energy consumption. Security mechanisms must be deployed in the architecture of almost all Wireless Sensor Networks. Several research papers have verified that group-based communications improve the efficiency of the network. For this reason, a secure group-based architecture for wireless sensor networks is described in this paper. First, the authors will explain the methods of key creation and how they are used. Then, the key management method, which is used to determine the tasks performed by the nodes to maintain the keys updated, is detailed. The process of secure communication between groups is also explained. Finally, energy consumption measurements for each protocol operation are shown.