Most visited

Recently visited

Added in API level 1

HandshakeCompletedEvent

public class HandshakeCompletedEvent
extends EventObject

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


此事件表示在给定SSL连接上完成SSL握手。 所有关于握手结果的核心信息都是通过“SSLSession”对象捕获的。 为了方便起见,这个事件类提供了对一些重要会话属性的直接访问。

此事件的来源是刚刚完成握手的SSLSocket。

也可以看看:

Summary

Inherited fields

From class 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

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

Public constructors

HandshakeCompletedEvent

Added in API level 1
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

Public methods

getCipherSuite

Added in API level 1
String getCipherSuite ()

返回由握手产生的会话使用的密码套件。 (这是从SSLsession获取密码组的便利方法。)

Returns
String the name of the cipher suite negotiated during this session.

getLocalCertificates

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

也可以看看:

getLocalPrincipal

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

也可以看看:

getPeerCertificateChain

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

也可以看看:

getPeerCertificates

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

也可以看看:

getPeerPrincipal

Added in API level 1
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

也可以看看:

getSession

Added in API level 1
SSLSession getSession ()

返回触发此事件的会话。

Returns
SSLSession the SSLSession for this handshake

getSocket

Added in API level 1
SSLSocket getSocket ()

返回此事件源的套接字。 (这是一个方便的功能,可以让应用程序在不进行类型转换的情况下编写代码。)

Returns
SSLSocket the socket on which the connection was made.

Hooray!