Class HandshakeCompletedEvent
java.lang.Object
java.util.EventObject
javax.net.ssl.HandshakeCompletedEvent
- All Implemented Interfaces:
Serializable
This event indicates that an SSL handshake completed on a given
SSL connection. All the core information about that handshake's
result is captured through an "SSLSession" object. As a convenience,
this event class provides direct access to some important session
attributes.
The source of this event is the SSLSocket on which handshaking just completed.
- Since:
- 1.4
- See Also:
-
Field Summary
Fields declared in class EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionHandshakeCompletedEvent(SSLSocket sock, SSLSession s) Constructs a new HandshakeCompletedEvent. -
Method Summary
Modifier and TypeMethodDescriptionReturns the cipher suite in use by the session which was produced by the handshake.Returns the certificate(s) that were sent to the peer during handshaking.Returns the principal that was sent to the peer during handshaking.Deprecated, for removal: This API element is subject to removal in a future version.Returns the identity of the peer which was established as part of defining the session.Returns the identity of the peer which was established as part of defining the session.Returns the session that triggered this event.Returns the socket which is the source of this event.Methods declared in class EventObject
getSource, toStringMethods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
HandshakeCompletedEvent
Constructs a new HandshakeCompletedEvent.- Parameters:
sock- the SSLSocket acting as the source of the events- the SSLSession this event is associated with
-
-
Method Details
-
getSession
Returns the session that triggered this event.- Returns:
- the
SSLSessionfor this handshake
-
getCipherSuite
Returns the cipher suite in use by the session which was produced by the handshake. (This is a convenience method for getting the ciphersuite from the SSLsession.)- Returns:
- the name of the cipher suite negotiated during this session.
-
getLocalCertificates
Returns the certificate(s) that were sent to the peer during handshaking. Note: This method is useful only when using certificate-based cipher suites. When multiple certificates are available for use in a handshake, the implementation chooses what it considers the "best" certificate chain available, and transmits that to the other side. This method allows the caller to know which certificate chain was actually used.- Returns:
- an ordered array of certificates, with the local certificate first followed by any certificate authorities. If no certificates were sent, then null is returned.
- See Also:
-
getPeerCertificates
Returns the identity of the peer which was established as part of defining the session. Note: This method can be used only when using certificate-based cipher suites; using it with non-certificate-based cipher suites, such as Kerberos, will throw an SSLPeerUnverifiedException.Note: The returned value may not be a valid certificate chain and should not be relied on for trust decisions.
- Returns:
- an ordered array of the peer certificates, with the peer's own certificate first followed by any certificate authorities.
- Throws:
SSLPeerUnverifiedException- if the peer is not verified.- See Also:
-
getPeerCertificateChain
@Deprecated(since="9", forRemoval=true) public X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedExceptionDeprecated, for removal: This API element is subject to removal in a future version.ThegetPeerCertificates()method that returns an array ofjava.security.cert.Certificateshould be used instead.Returns the identity of the peer which was identified as part of defining the session. Note: This method can be used only when using certificate-based cipher suites; using it with non-certificate-based cipher suites, such as Kerberos, will throw an SSLPeerUnverifiedException.Note: The returned value may not be a valid certificate chain and should not be relied on for trust decisions.
Note: this method exists for compatibility with previous releases. New applications should use
getPeerCertificates()instead.- Returns:
- an ordered array of peer X.509 certificates,
with the peer's own certificate first followed by any
certificate authorities. (The certificates are in
the original JSSE
X509Certificateformat). - Throws:
SSLPeerUnverifiedException- if the peer is not verified.UnsupportedOperationException- if the underlying provider does not implement theSSLSession.getPeerCertificateChain()operation.- See Also:
-
getPeerPrincipal
Returns the identity of the peer which was established as part of defining the session.- Returns:
- the peer's principal. Returns an X500Principal of the end-entity certificate for X509-based cipher suites, and KerberosPrincipal for Kerberos cipher suites.
- Throws:
SSLPeerUnverifiedException- if the peer's identity has not been verified- Since:
- 1.5
- See Also:
-
getLocalPrincipal
Returns the principal that was sent to the peer during handshaking.- Returns:
- the principal sent to the peer. Returns an X500Principal of the end-entity certificate for X509-based cipher suites, and KerberosPrincipal for Kerberos cipher suites. If no principal was sent, then null is returned.
- Since:
- 1.5
- See Also:
-
getSocket
Returns the socket which is the source of this event. (This is a convenience function, to let applications write code without type casts.)- Returns:
- the socket on which the connection was made.
-
getPeerCertificates()method that returns an array ofjava.security.cert.Certificateshould be used instead.