Skip to content

Most visited

Recently visited

navigation

HandshakeCompletedEvent

public class HandshakeCompletedEvent
extends EventObject

java.lang.Object
   ↳ java.util.EventObject
     ↳ javax.net.ssl.HandshakeCompletedEvent


This event indicates that an SSL handshake completed on a given SSL connection. All of 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.

See also:

Summary

Inherited fields

From class java.util.EventObject

Public constructors

HandshakeCompletedEvent(SSLSocket sock, SSLSession s)

Constructs a new HandshakeCompletedEvent.

Public methods

String getCipherSuite()

Returns the cipher suite in use by the session which was produced by the handshake.

Certificate[] getLocalCertificates()

Returns the certificate(s) that were sent to the peer during handshaking.

Principal getLocalPrincipal()

Returns the principal that was sent to the peer during handshaking.

X509Certificate[] getPeerCertificateChain()

Returns the identity of the peer which was identified as part of defining the session.

Certificate[] getPeerCertificates()

Returns the identity of the peer which was established as part of defining the session.

Principal getPeerPrincipal()

Returns the identity of the peer which was established as part of defining the session.

SSLSession getSession()

Returns the session that triggered this event.

SSLSocket getSocket()

Returns the socket which is the source of this event.

Inherited methods

From class java.util.EventObject
From class java.lang.Object

Public constructors

HandshakeCompletedEvent

Added in API level 1
HandshakeCompletedEvent (SSLSocket sock, 
                SSLSession s)

Constructs a new HandshakeCompletedEvent.

Parameters
sock SSLSocket: the SSLSocket acting as the source of the event
s SSLSession: the SSLSession this event is associated with

Public methods

getCipherSuite

Added in API level 1
String 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
String the name of the cipher suite negotiated during this session.

getLocalCertificates

Added in API level 1
Certificate[] 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
Certificate[] 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:

getLocalPrincipal

Added in API level 1
Principal getLocalPrincipal ()

Returns the principal that was sent to the peer during handshaking.

Returns
Principal 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.

See also:

getPeerCertificateChain

Added in API level 1
X509Certificate[] getPeerCertificateChain ()

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: this method exists for compatibility with previous releases. New applications should use getPeerCertificates() instead.

Returns
X509Certificate[] 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 X509Certificate format).
Throws
SSLPeerUnverifiedException if the peer is not verified.

See also:

getPeerCertificates

Added in API level 1
Certificate[] 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.

Returns
Certificate[] 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:

getPeerPrincipal

Added in API level 1
Principal getPeerPrincipal ()

Returns the identity of the peer which was established as part of defining the session.

Returns
Principal the peer's principal. Returns an X500Principal of the end-entity certiticate for X509-based cipher suites, and KerberosPrincipal for Kerberos cipher suites.
Throws
SSLPeerUnverifiedException if the peer's identity has not been verified

See also:

getSession

Added in API level 1
SSLSession getSession ()

Returns the session that triggered this event.

Returns
SSLSession the SSLSession for this handshake

getSocket

Added in API level 1
SSLSocket 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
SSLSocket the socket on which the connection was made.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.