tlsSocket.getPeerCertificate([detailed])


  • detailed <boolean> 如果为 true,则包含完整的证书链,否则仅包含对端证书。
  • 返回:<Object> 一个证书对象。

返回一个表示对等方证书的对象。如果对等方未提供证书,将返回一个空对象。如果套接字已被销毁,则返回 null

🌐 Returns an object representing the peer's certificate. If the peer does not provide a certificate, an empty object will be returned. If the socket has been destroyed, null will be returned.

如果请求了完整的证书链,每个证书都会包含一个 issuerCertificate 属性,其中包含表示其颁发者证书的对象。

🌐 If the full certificate chain was requested, each certificate will include an issuerCertificate property containing an object representing its issuer's certificate.