java.lang.Object
org.miaixz.bus.http.socket.Handshake
A record of a TLS handshake. This class holds information about the TLS version, cipher suite, and the certificates
of both the peer and the local party for an HTTPS connection.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Method Summary
Modifier and TypeMethodDescriptionReturns the cipher suite of the connection.booleanCompares this Handshake object with another for equality.static Handshakeget(SSLSession session) Creates a Handshake instance from an SSL session.static Handshakeget(org.miaixz.bus.core.net.tls.TlsVersion tlsVersion, CipherSuite cipherSuite, List<Certificate> peerCertificates, List<Certificate> localCertificates) Creates a Handshake instance from its components.inthashCode()Computes the hash code for this Handshake object.Returns a list of certificates that identify this side of the connection.Returns the principal that identifies this side of the connection.Returns a list of certificates that identify the remote peer.Returns the principal that identifies the remote peer.org.miaixz.bus.core.net.tls.TlsVersionReturns the TLS version of the connection.toString()Returns a string representation of this Handshake.
-
Method Details
-
get
Creates a Handshake instance from an SSL session.- Parameters:
session- The SSL session.- Returns:
- A new Handshake instance.
- Throws:
IOException- if the session is invalid or parsing fails.
-
get
public static Handshake get(org.miaixz.bus.core.net.tls.TlsVersion tlsVersion, CipherSuite cipherSuite, List<Certificate> peerCertificates, List<Certificate> localCertificates) Creates a Handshake instance from its components.- Parameters:
tlsVersion- The TLS version.cipherSuite- The cipher suite.peerCertificates- The list of peer certificates.localCertificates- The list of local certificates.- Returns:
- A new Handshake instance.
- Throws:
NullPointerException- if tlsVersion or cipherSuite is null.
-
tlsVersion
public org.miaixz.bus.core.net.tls.TlsVersion tlsVersion()Returns the TLS version of the connection.- Returns:
- The
TlsVersion.
-
cipherSuite
Returns the cipher suite of the connection.- Returns:
- The
CipherSuite.
-
peerCertificates
Returns a list of certificates that identify the remote peer.- Returns:
- An immutable list of certificates, which may be empty.
-
peerPrincipal
Returns the principal that identifies the remote peer.- Returns:
- The peer's principal, or null if the peer is anonymous.
-
localCertificates
Returns a list of certificates that identify this side of the connection.- Returns:
- An immutable list of certificates, which may be empty.
-
localPrincipal
Returns the principal that identifies this side of the connection.- Returns:
- The local principal, or null if this side is anonymous.
-
equals
Compares this Handshake object with another for equality. -
hashCode
public int hashCode()Computes the hash code for this Handshake object. -
toString
Returns a string representation of this Handshake.
-