- java.lang.Object
-
- java.util.EventObject
-
- javax.net.ssl.HandshakeCompletedEvent
-
- All Implemented Interfaces:
- Serializable
public class HandshakeCompletedEvent extends EventObject
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.
- Since:
- 1.4
- See Also:
SSLSocket
,HandshakeCompletedListener
,SSLSession
, Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.EventObject
source
-
-
Constructor Summary
Constructors Constructor and Description HandshakeCompletedEvent(SSLSocket sock, SSLSession s)
Constructs a new HandshakeCompletedEvent.
-
Method Summary
Methods Modifier and Type Method and 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()
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.
-
-
-
Constructor Detail
-
HandshakeCompletedEvent
public HandshakeCompletedEvent(SSLSocket sock, SSLSession s)
Constructs a new HandshakeCompletedEvent.- Parameters:
sock
- the SSLSocket acting as the source of the events
- the SSLSession this event is associated with
-
-
Method Detail
-
getSession
public SSLSession getSession()
Returns the session that triggered this event.- Returns:
- the
SSLSession
for this handshake
-
getCipherSuite
public 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:
- the name of the cipher suite negotiated during this session.
-
getLocalCertificates
public 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:
- 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()
-
getPeerCertificates
public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException
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:
- 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()
-
getPeerCertificateChain
public X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException
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:
- 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:
getPeerPrincipal()
-
getPeerPrincipal
public Principal getPeerPrincipal() throws SSLPeerUnverifiedException
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 certiticate 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:
getPeerCertificates()
,getLocalPrincipal()
-
getLocalPrincipal
public Principal 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:
getLocalCertificates()
,getPeerPrincipal()
-
getSocket
public 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:
- the socket on which the connection was made.
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/net/ssl/handshakecompletedevent.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur Deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.