tlsSocket.getPeerCertificate([detailed])


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

返回代表对等方证书的对象。 如果对端没有提供证书,则将返回空对象。 如果套接字被销毁,则返回 null

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

  • detailed <boolean> Include the full certificate chain if true, otherwise include just the peer's certificate.
  • Returns: <Object> A certificate object.

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.

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