public class SSLParameters extends Object
SSLParameters可以通过此类中的构造函数创建。 也可以使用SSLSocket和SSLServerSocket和SSLEngine中的getSSLParameters()方法或SSLContext中的getDefaultSSLParameters()和getSupportedSSLParameters()方法获得SSLContext 。
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()
返回密码组数组的副本,如果没有设置则返回null。
|
String |
getEndpointIdentificationAlgorithm()
获取端点识别算法。
|
boolean |
getNeedClientAuth()
返回是否需要客户端身份验证。
|
String[] |
getProtocols()
返回协议数组的副本,如果没有设置,则返回null。
|
List<SNIServerName> |
getServerNames()
返回 List包含所有SNIServerName •服务器名称指示的(SNI)的参数,如果没有则为null已设置。
|
Collection<SNIMatcher> |
getSNIMatchers()
返回 Collection包含所有SNIMatcher •服务器名称指示的(SNI)的参数,如果没有则为null已设置。
|
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)
调用此构造函数等效于调用no-args构造函数,后跟setCipherSuites(cipherSuites); 。
cipherSuites - 密码队列(或null)
public String[] getCipherSuites()
public void setCipherSuites(String[] cipherSuites)
cipherSuites - 密码队列(或null)
public String[] getProtocols()
public void setProtocols(String[] protocols)
protocols - 协议数组(或null)
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 - 算法约束(或null)
public String getEndpointIdentificationAlgorithm()
X509ExtendedTrustManager , setEndpointIdentificationAlgorithm(String)
public void setEndpointIdentificationAlgorithm(String algorithm)
如果algorithm参数为非空或非空,则必须在SSL / TLS握手期间处理端点标识/验证过程。 这是为了防止中间人的袭击。
algorithm - 端点标识算法的标准字符串名称(或null)。
有关标准算法名称的信息,请参阅Java Cryptography Architecture API Specification & Reference中的附录A.
X509ExtendedTrustManager
public final void setServerNames(List<SNIServerName> serverNames)
SNIServerName个 S中的服务器名称指示(SNI)参数。
此方法仅对客户端模式下运行的SSLSocket s或SSLEngine有用。
请注意, serverNames列表被克隆以防止后续修改。
serverNames - 所需的SNIServerName的列表(或null)
NullPointerException - 如果
serverNames包含
null元素
IllegalArgumentException - 如果
serverNames包含多个名称相同的名称类型
SNIServerName , getServerNames()
public final List<SNIServerName> getServerNames()
List包含所有SNIServerName •服务器名称指示的(SNI)的参数,如果没有则为null已设置。
此方法仅对客户端模式下运行的SSLSocket s或SSLEngine有用。
对于SSL / TLS连接,底层SSL / TLS提供程序可能会为某个服务器名称类型指定默认值。 在客户端模式下,建议默认情况下,每当服务器可以通过受支持的服务器名称类型定位时,提供程序应包括服务器名称指示。
建议供应商创建初始化时默认的服务器名称主治SSLSocket / SSLEngine秒。 在以下实施例中,服务器名称可以通过的一个实例被表示SNIHostName已初始化主机名“www.example.com”和类型StandardConstants.SNI_HOST_NAME 。
Socket socket =
sslSocketFactory.createSocket("www.example.com", 443);
要么
SSLEngine engine =
sslContext.createSSLEngine("www.example.com", 443);
SNIServerName s
List , setServerNames(List)
public final void setSNIMatchers(Collection<SNIMatcher> matchers)
SNIMatcher个 S中的服务器名称指示(SNI)参数。
此方法只对有用SSLSocket个 S或SSLEngine个 S IN服务器模式下工作。
请注意, matchers集合被克隆以防止后续修改。
matchers - 收集SNIMatcher s(或null)
NullPointerException - 如果
matchers包含
null元素
IllegalArgumentException - 如果
matchers包含多个名称相同的名称类型
Collection , SNIMatcher , getSNIMatchers()
public final Collection<SNIMatcher> getSNIMatchers()
Collection包含所有SNIMatcher •服务器名称指示的(SNI)的参数,如果没有则为null已设置。
此方法只对有用SSLSocket个 S或SSLEngine个 S IN服务器模式下工作。
为了更好的互操作性,提供商通常不会定义默认的匹配器,因此默认情况下,服务器将忽略SNI扩展并继续握手。
SNIMatcher s
SNIMatcher , setSNIMatchers(Collection)
public final void setUseCipherSuitesOrder(boolean honorOrder)
honorOrder - 在SSL / TLS握手期间是否应该遵守
#getCipherSuites本地密码套餐订单。
getUseCipherSuitesOrder()
public final boolean getUseCipherSuitesOrder()
#getCipherSuites中的
#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.