public class HandshakeCompletedEvent 
  extends EventObject 
| java.lang.Object | ||
| java.util.EventObject | ||
| javax.net.ssl.HandshakeCompletedEvent | ||
此事件表示在给定SSL连接上完成SSL握手。 所有关于握手结果的核心信息都是通过“SSLSession”对象捕获的。 为了方便起见,这个事件类提供了对一些重要会话属性的直接访问。
此事件的来源是刚刚完成握手的SSLSocket。
Inherited fields |  
      
|---|
  java.util.EventObject  
         |  
      
Public constructors |  
      |
|---|---|
  HandshakeCompletedEvent(SSLSocket sock, SSLSession s)  构造一个新的HandshakeCompletedEvent。  |  
      |
公共方法(Public methods) |  
      |
|---|---|
 String  |  
         getCipherSuite()  返回由握手产生的会话使用的密码套件。  |  
      
 Certificate[]  |  
         getLocalCertificates()  返回握手期间发送给对等体的证书。  |  
      
 Principal  |  
         getLocalPrincipal()  返回握手期间发送给对等体的主体。  |  
      
 X509Certificate[]  |  
         getPeerCertificateChain()  返回被确定为定义会话一部分的对等者的身份。  |  
      
 Certificate[]  |  
         getPeerCertificates()  返回作为定义会话一部分而建立的对等的身份。  |  
      
 Principal  |  
         getPeerPrincipal()  返回作为定义会话一部分而建立的对等的身份。  |  
      
 SSLSession  |  
         getSession()  返回触发此事件的会话。  |  
      
 SSLSocket  |  
         getSocket()  返回此事件源的套接字。  |  
      
继承方法(Inherited methods) |  
      |
|---|---|
  java.util.EventObject  
         |  
      |
  java.lang.Object  
         |  
      |
HandshakeCompletedEvent (SSLSocket sock, SSLSession s)
构造一个新的HandshakeCompletedEvent。
| 参数(Parameters) | |
|---|---|
sock |  
         SSLSocket: the SSLSocket acting as the source of the event |  
       
s |  
         SSLSession: the SSLSession this event is associated with  |  
       
String getCipherSuite ()
返回由握手产生的会话使用的密码套件。 (这是从SSLsession获取密码组的便利方法。)
| 返回(Returns) | |
|---|---|
String |  
        the name of the cipher suite negotiated during this session. | 
Certificate[] getLocalCertificates ()
返回握手期间发送给对等体的证书。 注意:仅当使用基于证书的密码套件时,此方法才有用。 当多个证书可用于握手时,实现选择它认为可用的“最佳”证书链,并将其传递给另一方。 该方法允许调用者知道实际使用哪个证书链。
| 返回(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. | 
也可以看看:
Principal getLocalPrincipal ()
返回握手期间发送给对等体的主体。
| 返回(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. | 
X509Certificate[] getPeerCertificateChain ()
返回被确定为定义会话一部分的对等者的身份。 注意:只有在使用基于证书的密码套件时才能使用此方法; 将它与非基于证书的密码套件(如Kerberos)一起使用时,将引发SSLPeerUnverifiedException。
注意:此方法与以前的版本兼容。 新的应用程序应该使用getPeerCertificates() 。
| 返回(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. | 
也可以看看:
Certificate[] getPeerCertificates ()
返回作为定义会话一部分而建立的对等的身份。 注意:只有在使用基于证书的密码套件时才能使用此方法; 将它与非基于证书的密码套件(如Kerberos)一起使用时,将引发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. | 
也可以看看:
Principal getPeerPrincipal ()
返回作为定义会话一部分而建立的对等的身份。
| 返回(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 | 
SSLSession getSession ()
返回触发此事件的会话。
| 返回(Returns) | |
|---|---|
SSLSession |  
        the SSLSession for this handshake  |  
       
SSLSocket getSocket ()
返回此事件源的套接字。 (这是一个方便的功能,可以让应用程序在不进行类型转换的情况下编写代码。)
| 返回(Returns) | |
|---|---|
SSLSocket |  
        the socket on which the connection was made. |