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.