Added code for isPublicKey