public class SSLParameters extends Object
sslparameters可以通过创建该类的构造函数。对象也可以在SSLSocket
和SSLServerSocket
和SSLEngine
或SSLContext
的getDefaultSSLParameters()
和getSupportedSSLParameters()
方法采用getSSLParameters()
方法获得。
sslparameters可以通过方法SSLSocket.setSSLParameters()
和SSLServerSocket.setSSLParameters()
和SSLEngine.setSSLParameters()
用于连接。
SSLSocket
,
SSLEngine
,
SSLContext
Constructor and Description |
---|
SSLParameters()
构建sslparameters。
|
SSLParameters(String[] cipherSuites)
构建sslparameters从指定数组的密码套件。
|
SSLParameters(String[] cipherSuites, String[] protocols)
构建sslparameters从指定数组密码套件和协议。
|
Modifier and Type | Method and Description |
---|---|
AlgorithmConstraints |
getAlgorithmConstraints()
返回密码算法约束。
|
String[] |
getCipherSuites()
返回一个拷贝的密码套件或空数组如果没有设置。
|
String |
getEndpointIdentificationAlgorithm()
获取端点识别算法。
|
boolean |
getNeedClientAuth()
返回客户端身份验证是否应该被要求。
|
String[] |
getProtocols()
返回一个协议或空数组的副本,如果没有被设置。
|
List<SNIServerName> |
getServerNames()
返回一个包含所有
SNIServerName s
List 的服务器名称指示(SNI)的参数,如果没有设置或空。
|
Collection<SNIMatcher> |
getSNIMatchers()
返回一个包含所有
SNIMatcher s
Collection 的服务器名称指示(SNI)的参数,如果没有设置或空。
|
boolean |
getUseCipherSuitesOrder()
返回本地密码是否应该被授予本地密码。
|
boolean |
getWantClientAuth()
返回客户端身份验证是否应被请求。
|
void |
setAlgorithmConstraints(AlgorithmConstraints constraints)
设置的加密算法的约束,这将被用于除了任何配置的运行时环境。
|
void |
setCipherSuites(String[] cipherSuites)
设置密码组阵列。
|
void |
setEndpointIdentificationAlgorithm(String algorithm)
设置端点识别算法。
|
void |
setNeedClientAuth(boolean needClientAuth)
是否需要设置客户端身份验证。
|
void |
setProtocols(String[] protocols)
设置协议数组。
|
void |
setServerNames(List<SNIServerName> serverNames)
设置服务器名称指示所需的
SNIServerName s(SNI)参数。
|
void |
setSNIMatchers(Collection<SNIMatcher> matchers)
设置服务器名称指示的
SNIMatcher s(SNI)参数。
|
void |
setUseCipherSuitesOrder(boolean honorOrder)
设置本地密码套件是否应该被授予优先。
|
void |
setWantClientAuth(boolean wantClientAuth)
设置是否应请求客户端身份验证。
|
public SSLParameters()
的密码套件,价值协议,加密算法的限制,端点识别算法,服务器名称和服务器名称匹配器将null
,useciphersuitesorder,wantclientauth和needclientauth将false
。
public SSLParameters(String[] cipherSuites)
调用此构造函数相当于调用无参构造函数依次setCipherSuites(cipherSuites);
。
cipherSuites
-密码组阵列(或零)
public String[] getCipherSuites()
public void setCipherSuites(String[] cipherSuites)
cipherSuites
-密码组阵列(或零)
public String[] getProtocols()
public void setProtocols(String[] protocols)
protocols
-协议的阵列(或零)
public boolean getWantClientAuth()
public void setWantClientAuth(boolean wantClientAuth)
needClientAuth
旗。
wantClientAuth
是否应要求客户端身份验证
public boolean getNeedClientAuth()
public void setNeedClientAuth(boolean needClientAuth)
wantClientAuth
旗。
needClientAuth
是否需要客户端认证
public AlgorithmConstraints getAlgorithmConstraints()
setAlgorithmConstraints(AlgorithmConstraints)
public void setAlgorithmConstraints(AlgorithmConstraints constraints)
如果constraints
参数非空,每一个加密算法,使用SSL / TLS握手密钥和算法参数必须由约束允许的。
constraints
算法的约束(或零)
public String getEndpointIdentificationAlgorithm()
X509ExtendedTrustManager
,
setEndpointIdentificationAlgorithm(String)
public void setEndpointIdentificationAlgorithm(String algorithm)
如果algorithm
参数非空或非空,端点识别/验证程序必须处理在SSL / TLS握手。这是为了防止人在中间的攻击。
algorithm
的端点识别算法标准字符串名称(或零)。见附录A中的
Java Cryptography Architecture API Specification & Reference 有关标准算法名称信息。
X509ExtendedTrustManager
public final void setServerNames(List<SNIServerName> serverNames)
SNIServerName
s(SNI)参数。
此方法仅用于SSLSocket
s或SSLEngine
s在客户端模式操作。
需要注意的是,克隆以防止后续修改的serverNames
列表。
serverNames
-所需的
SNIServerName
s列表(或零)
NullPointerException
-如果
serverNames
包含
null
元
IllegalArgumentException
-如果
serverNames
包含多个名称相同的名称类型
SNIServerName
,
getServerNames()
public final List<SNIServerName> getServerNames()
SNIServerName
s
List
的服务器名称指示(SNI)的参数,如果没有设置或空。
此方法仅用于SSLSocket
s或SSLEngine
s在客户端模式操作。
SSL / TLS连接,底层SSL / TLS的提供者可以指定某个服务器名称类型的默认值。在客户端模式中,建议默认情况下,当服务器可以位于受支持的服务器名称类型时,应包括服务器名称指示。
建议供应商初始化默认的服务器名称指示创建SSLSocket
/ SSLEngine
s时。在下面的例子中,服务器名称,可以通过SNIHostName
已与主机名”www.example初始化的实例表示。com”型StandardConstants.SNI_HOST_NAME
。
插座插座=createsocket SSLSocketFactory。(“www.example .com”,443);或
sslengine发动机=createsslengine SSLContext。(“www.example .com”,443);
SNIServerName
s列表
List
,
setServerNames(List)
public final void setSNIMatchers(Collection<SNIMatcher> matchers)
matchers
-
SNIMatcher
s收集(或零)
NullPointerException
-如果
matchers
包含
null
元
IllegalArgumentException
-如果
matchers
包含多个名称相同的名称类型
Collection
,
SNIMatcher
,
getSNIMatchers()
public final Collection<SNIMatcher> getSNIMatchers()
SNIMatcher
s
Collection
的服务器名称指示(SNI)的参数,如果没有设置或空。
此方法仅用于SSLSocket
s或SSLEngine
s服务器模式运行。
为更好的互操作性,供应商一般不会定义默认的匹配,默认情况下,服务器会忽略SNI的延伸和继续的握手。
SNIMatcher
s
SNIMatcher
,
setSNIMatchers(Collection)
public final void setUseCipherSuitesOrder(boolean honorOrder)
honorOrder
-无论是本地密码套件订单
#getCipherSuites
应该荣幸在SSL / TLS握手。
getUseCipherSuitesOrder()
public final boolean getUseCipherSuitesOrder()
#getCipherSuites
应该荣幸在SSL / TLS握手。
setUseCipherSuitesOrder(boolean)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.