In wireless sensor networks, the security attacks are due to the compromise of the large part of the network which can cause node damage or disturbance in the data flow. At the time of re-keying process, if the re-key from the sink is not securely transmitted to the compromised node, it will lead to denial of service attack. In this paper, the authors propose a cluster based key management technique for authentication in wireless sensor networks. Initially, clusters are formed in the network and the cluster heads are selected based on the energy cost, coverage and processing capacity. The sink assigns cluster key to every cluster and an EBS key set to every cluster head.