tlsSocket.getProtocol()


返回一个字符串,包含当前连接协商的 SSL/TLS 协议版本。对于尚未完成握手过程的已连接套接字,将返回值 'unknown'。对于服务器套接字或已断开连接的客户端套接字,将返回值 null

【Returns a string containing the negotiated SSL/TLS protocol version of the current connection. The value 'unknown' will be returned for connected sockets that have not completed the handshaking process. The value null will be returned for server sockets or disconnected client sockets.】

协议版本为:

【Protocol versions are:】

  • 'SSLv3'
  • 'TLSv1'
  • 'TLSv1.1'
  • 'TLSv1.2'
  • 'TLSv1.3'

有关更多信息,请参阅 OpenSSL SSL_get_version 文档。

【See the OpenSSL SSL_get_version documentation for more information.】