A wireless ad hoc network that has no connection to the Internet has difficulty to construct a public key infrastructure (PKI) when the network does not provide online access to trusted authorities. In this paper, we propose an on demand distributed public key management to construct the PKI for wireless ad hoc networks. The proposed system collects effective certificates on demand. Each node holds in its local repository only the certificates issued to it in order to reduce the amount of memory. To collect certificates efficiently, we propose an ad hoc simultaneous nodes search protocol (ASNS) that can search chained nodes using broadcast packets and routing tables. The proposed system can reduce memory size for authentication and does not have to manage a certificate revocation list (CRL). By a computer simulation, we show that the system is advantageous to the network in which density of the node is low.