Added error checking to the search method for pub / private keys.