crypto: clear error in GetPeerCertificate

fix #6945