Share via


SSLCertificateSocketFactory 类

定义

具有多个额外功能的 SSLSocketFactory 实现:

        <ul>
        <li>Timeout specification for SSL handshake operations
        <li>Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
[Android.Runtime.Register("android/net/SSLCertificateSocketFactory", DoNotGenerateAcw=true)]
public class SSLCertificateSocketFactory : Javax.Net.Ssl.SSLSocketFactory
[<Android.Runtime.Register("android/net/SSLCertificateSocketFactory", DoNotGenerateAcw=true)>]
type SSLCertificateSocketFactory = class
    inherit SSLSocketFactory
继承
SSLCertificateSocketFactory
属性

注解

具有多个额外功能的 SSLSocketFactory 实现:

<ul><li>Ssl 握手操作<的超时规范 li>主机名验证在大多数情况下 (请参阅下面的 WARNING) <li>可选 SSL 会话缓存使用<SSLSessionCache li>可选绕过所有 SSL 证书检查 </ul>

握手超时不适用于实际的 TCP 套接字连接。 如果还需要连接超时,请使用 #createSocket()Socket#connect(java.net.SocketAddress, int),然后必须验证连接到的服务器的身份。

<p class=“caution”><b>大多数SSLSocketFactory实现不验证服务器的身份,从而允许中间人攻击。</b> 此实现检查服务器的证书主机名,但仅适用于指定主机名的 createSocket 变体。 使用或 InetAddress 返回未连接的套接字的方法时,必须自行验证服务器的标识以确保安全连接。

有关详细信息,请参阅 更新安全提供程序以防范 SSL 攻击 。</P>

验证服务器标识的建议方法是使用 HttpsURLConnection#getDefaultHostnameVerifier() 获取 HostnameVerifier 来验证证书主机名。

<b>警告</b>:此类上的某些方法返回连接的套接字,某些方法返回未连接的套接字。 对于返回连接套接字的方法,在这些套接字上设置与连接或握手相关的属性将不起作用。

在开发设备上,“setprop socket.relaxsslcheck yes”会绕过所有 SSL 证书和主机名检查以进行测试。 此设置需要根访问权限。

此成员已弃用。 此类使用标准 API 的替换方法不太容易出错。 若要创建 , SSLSocketSSLSocketFactorySSLSocketFactory#getDefault()javax.net.ssl.SSLContext#getSocketFactory()获取 。 若要验证主机名,请将 传递给 "HTTPS"javax.net.ssl.SSLParameters#setEndpointIdentificationAlgorithm(String)。 若要启用 ALPN,请使用 javax.net.ssl.SSLParameters#setApplicationProtocols(String[])。 若要启用 SNI,请使用 javax.net.ssl.SSLParameters#setServerNames(java.util.List)

android.net.SSLCertificateSocketFactoryJava 文档。

此页面的某些部分是基于 创建和共享的工作进行的修改,并根据 署名许可中所述的条款使用。

构造函数

SSLCertificateSocketFactory(Int32)
已过时.

此成员已弃用。

SSLCertificateSocketFactory(IntPtr, JniHandleOwnership)

创建 JNI 对象的托管表示形式时使用的构造函数;由运行时调用。

属性

Class

返回此 Object的运行时类。

(继承自 Object)
Handle

基础 Android 实例的句柄。

(继承自 Object)
JniIdentityHashCode

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
JniPeerMembers

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
PeerReference

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
ThresholdClass

此 API 支持 Mono for Android 基础结构,不应直接从代码中使用。

ThresholdType

此 API 支持 Mono for Android 基础结构,不应直接从代码中使用。

方法

Clone()

创建并返回此对象的副本。

(继承自 Object)
CreateSocket()

创建未连接的套接字。

(继承自 SocketFactory)
CreateSocket(InetAddress, Int32)
已过时.

要添加

CreateSocket(InetAddress, Int32, InetAddress, Int32)
已过时.

要添加

CreateSocket(Socket, String, Int32, Boolean)
已过时.

要添加

CreateSocket(String, Int32)
已过时.

要添加

CreateSocket(String, Int32, InetAddress, Int32)
已过时.

要添加

Dispose()

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
Dispose(Boolean)

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
Equals(Object)

指示某个其他对象是否“等于”此对象。

(继承自 Object)
GetDefault(Int32)

返回具有可选握手超时的新套接字工厂实例。

GetDefault(Int32, SSLSessionCache)

返回具有可选握手超时和 SSL 会话缓存的新套接字工厂实例。

GetDefaultCipherSuites()
已过时.

返回默认启用的密码套件的名称。

GetHashCode()

返回对象的哈希代码值。

(继承自 Object)
GetHttpSocketFactory(Int32, SSLSessionCache)

返回一个套接字工厂 (也名为 SSLSocketFactory,但在不同的命名空间中) 用于 Apache HTTP 堆栈。

GetInsecure(Int32, SSLSessionCache)

使用可选的握手超时和 SSL 会话缓存,返回已禁用所有 SSL 安全检查的套接字工厂的新实例。

GetNpnSelectedProtocol(Socket)

返回客户端和服务器选择 的下一个协议协商 (NPN) 协议,如果未协商协议,则返回 null。

GetSupportedCipherSuites()
已过时.

返回支持并且可以为 SSL 连接启用的密码套件的名称。

JavaFinalize()

当垃圾回收确定不再引用对象时,由垃圾回收器对对象调用。

(继承自 Object)
Notify()

唤醒正在等待此对象的监视器的单个线程。

(继承自 Object)
NotifyAll()

唤醒正在等待此对象的监视器的所有线程。

(继承自 Object)
SetHandle(IntPtr, JniHandleOwnership)

设置 Handle 属性。

(继承自 Object)
SetHostname(Socket, String)

在给定套接字 上打开服务器名称指示 (SNI)

SetKeyManagers(IKeyManager[])

KeyManager设置要用于此工厂建立的连接的 。

SetNpnProtocols(Byte[][])

设置下 一个协议协商 (NPN) 此对等方感兴趣的协议。

SetTrustManagers(ITrustManager[])

TrustManager设置要用于此工厂建立的连接的 。

SetUseSessionTickets(Socket, Boolean)

在给定套接字上启用 会话票证 支持。

ToArray<T>()

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
ToString()

返回对象的字符串表示形式。

(继承自 Object)
UnregisterFromRuntime()

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
Wait()

导致当前线程等待,直到它被唤醒,通常是通过 em <通知/em> 或 <em>interrupted</em>。<>

(继承自 Object)
Wait(Int64)

导致当前线程等待,直到它被唤醒,通常是通过 em <通知/em> 或 <em>interrupted</em>,或直到经过一定数量的实时。<>

(继承自 Object)
Wait(Int64, Int32)

导致当前线程等待,直到它被唤醒,通常是通过 em <通知/em> 或 <em>interrupted</em>,或直到经过一定数量的实时。<>

(继承自 Object)

显式接口实现

IJavaPeerable.Disposed()

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
IJavaPeerable.DisposeUnlessReferenced()

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
IJavaPeerable.Finalized()

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
IJavaPeerable.JniManagedPeerState

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
IJavaPeerable.SetJniIdentityHashCode(Int32)

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates)

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)
IJavaPeerable.SetPeerReference(JniObjectReference)

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
(继承自 Object)

扩展方法

JavaCast<TResult>(IJavaObject)

执行 Android 运行时检查的类型转换。

JavaCast<TResult>(IJavaObject)

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.
GetJniTypeName(IJavaPeerable)

具有多个额外功能的 SSLSocketFactory 实现:

        &lt;ul&gt;
        &lt;li&gt;Timeout specification for SSL handshake operations
        &lt;li&gt;Hostname verification in most cases (see WARNINGs below)
        &lt;li&gt;Optional SSL session caching with <code data-dev-comment-type="c">SSLSessionCache</code>&lt;li&gt;Optionally bypass all SSL certificate checks
        &lt;/ul&gt;

        The handshake timeout does not apply to actual TCP socket connection.

适用于