The wireless and distributed nature of MANETs poses a great challenge to system security designers. Key management is crucial part of security, this issue is even bigger in MANETs. The distribution of encryption keys in an authenticated manner is a difficult task. Because of dynamic nature of MANETs, when a node leaves or joins it need to generate new session key to maintain forward and backward secrecy. In this paper we divide the network into clusters. Cluster head will maintain the group key, it will also update the group key whenever there is a change in the membership within the cluster. We have the implementation results by having communication between client and server via agent using strong encryption at both ends.