In a vehicular ad hoc network (VANET) environment, it is not easy to keep data secure and private. If the private data are stolen, the hacker might have the user identity and do some bad things. To provide secure transmitting, some data encryption mechanisms are necessary. In this paper, we proposed a group key management mechanism for data communication in VANETs. It is exploited on the basis of a decentralized architecture with the hierarchical key tree and cluster heads. The proposed mechanism not only provides a rekeying method in reducing the communication cost but also furnishes the forward security and backward security. Copyright © 2012 John Wiley & Sons, Ltd.