Lifetime enhancement has always been a crucial issue as most of the wireless sensor networks (WSNs) operate in unattended environment where human access and monitoring are practically infeasible. Clustering is one of the most powerful techniques that can arrange the system operation in associated manner to attend the network scalability, minimize energy consumption and achieve prolonged network lifetime. An efficient path selection will reduce energy utilization on data transmission phase at this time data should be secure, by using RSA algorithm.  In this paper, clustering mechanism and improvement in security is proposed. These two methods are used to decrease the energy consumption at data transmission phase and ensuring the security of the sensor data over wireless sensor .Key based security mechanism is used to secure the data. To ensure that any energy consumption associated with the role of the cluster head (CH) is shared between the nodes, the cluster head (CH) role is alternated between the nodes using duty cycle mechanism.