Dynamic wireless sensor network (DWSN) is a group of mobile sensor nodes deployed in an intended area. Secure communication in DWSNs depends on the existence of an efficient key management scheme. Because of the movements of sensor nodes and unknown mobility pattern, dynamic key management is an important issue in such networks. In this paper, we propose a new key management scheme, which uses key pre‐distribution and post‐deployment key establishment mechanisms for DWSNs. The proposed approach ensures that the two communicating nodes share at least one common key. It also provides efficient ways for key generation and revocation as well as addition or deletion of mobile sensor nodes. Compared with the other key management schemes, which are designed for DWSNs, our simulation and analytical results demonstrate the efficiency of the proposed approach in terms of confidentiality, resilience, memory usage, energy consumption and overhead. Copyright © 2014 John Wiley & Sons, Ltd.