Class HandshakeCompletedEvent
- All Implemented Interfaces:
Serializable
public class HandshakeCompletedEvent extends EventObject
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 | Modifier and Type | Field | Description |
|---|---|---|
protected Object |
source |
The object on which the Event initially occurred. |
Constructor Summary
| Constructor | Description |
|---|---|
HandshakeCompletedEvent |
Constructs a new HandshakeCompletedEvent. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
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() |
Deprecated, for removal: This API element is subject to removal in a future version. |
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. |
Methods declared in class EventObject
getSource, toString | Modifier and Type | Method | Description |
|---|---|---|
Object |
getSource() |
The object on which the Event initially occurred. |
String |
toString() |
Returns a String representation of this EventObject. |
Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
protected Object |
clone() |
Creates and returns a copy of this object. |
boolean |
equals |
Indicates whether some other object is "equal to" this one. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
int |
hashCode() |
Returns a hash code value for this object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Constructor Details
HandshakeCompletedEvent
public HandshakeCompletedEvent(SSLSocket sock, SSLSession s)
- Parameters:
-
sock- the SSLSocket acting as the source of the event -
s- the SSLSession this event is associated with
Method Details
getSession
public SSLSession getSession()
- Returns:
- the
SSLSessionfor this handshake
getCipherSuite
public String getCipherSuite()
- Returns:
- the name of the cipher suite negotiated during this session.
getLocalCertificates
public Certificate[] getLocalCertificates()
- 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
public Certificate[] getPeerCertificates() throws 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 SSLPeerUnverifiedException
getPeerCertificates() method that returns an array of java.security.cert.Certificate should be used instead.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
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException
- 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
public Principal getLocalPrincipal()
- 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
public SSLSocket getSocket()
- Returns:
- the socket on which the connection was made.
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
getPeerCertificates()method that returns an array ofjava.security.cert.Certificateshould be used instead.