Wireless sensor networks (WSNs) consist of a large number of sensor nodes that are distributed to capture the information about an area of interest. In WSN, many of the secure data aggregation works are conducted without addressing the authentication process. It is challenging to implement authentication while preserving the energy consumption in the network. The previous research that focus on these issues have several limitations, such as sharing the security key and the key length with a base station node, and not much attention is given to enhance the authentication of the Medium Access Control (MAC) server. This makes the data aggregation network are exposed to malicious activities. This paper presents a new protocol to address the security and energy issue in Wireless Sensor Network (WSN). This newly developed protocol is named Secure and Energy-Efficient Data Aggregation (SEEDA), which is the extension of SDAACA protocol. The proposed protocol aims to enhance authentication by generating a random value and random timestamp with a secret key. The base station node will verify the fake aggregated data when the packets are received using the generated key earlier. Furthermore, the attacks are detected and prevented by utilizing secure node authentication, data fragmentation algorithms, fully homomorphic encryption, and access control model. The secure node authentication algorithm prevents attacks from accessing the network. To avoid network delays, the base station node utilizes the distance information between the participating nodes. To ensure the reliability of our proposed method, we simulate two well-known attacks, called Sybil and sinkhole attacks. Several experimental scenarios are conducted to observe their effect. Evaluation metrics such as malicious activity detection rate, energy consumption, end-to-end delay, and resilience time are measured. The performance of the proposed protocol is compared with SDA, SDAT, SDALFA, EESSDA, SDAACA, and EESDA, which is a widely used protocol in the area of secure data aggregation. The simulation results show that the proposed SEEDA method outperforms the existing scheme with 98.84% malicious nodes detection rate, 3.04 joules for energy consumption, the maximum delay of 0.038 seconds, and the resilient time 0.054, 0.075 seconds when 8%,16% of malicious nodes affecting the network.