A key management strategy is presented for heterogeneous wireless sensor networks. The wireless sensor networks have some sensor nodes which have greater power and transmission capability than other nodes have. Both ordinary nodes and heterogeneous nodes are evenly distributed in sensing square area respectively. The pairwise keys between nodes are established through utilizing the concept of the overlap key sharing and the random key predistribution scheme. Analysis and comparison demonstrate that the connectivity and security of wireless sensor networks have been improved obviously even with some heterogeneous nodes.