public class SSLContextBuilder extends Object
SSLContext
构建器Modifier and Type | Field and Description |
---|---|
static String |
SSL
Supports some version of SSL; may support other versions
|
static String |
SSLv2
Supports SSL version 2 or later; may support other versions
|
static String |
SSLv3
Supports SSL version 3; may support other versions
|
static String |
TLS
Supports some version of TLS; may support other versions
|
static String |
TLSv1
Supports RFC 2246: TLS version 1.0 ; may support other versions
|
static String |
TLSv11
Supports RFC 4346: TLS version 1.1 ; may support other versions
|
static String |
TLSv12
Supports RFC 5246: TLS version 1.2 ; may support other versions
|
Constructor and Description |
---|
SSLContextBuilder() |
Modifier and Type | Method and Description |
---|---|
SSLContext |
build()
|
SSLContext |
buildQuietly()
|
static SSLContextBuilder |
create()
创建 SSLContextBuilder
|
SSLContextBuilder |
setKeyManagers(KeyManager... keyManagers)
设置 JSSE key managers
|
SSLContextBuilder |
setProtocol(String protocol)
设置协议。例如TLS等
|
SSLContextBuilder |
setSecureRandom(SecureRandom secureRandom)
设置 SecureRandom
|
SSLContextBuilder |
setTrustManagers(TrustManager... trustManagers)
设置信任信息
|
public static final String SSL
public static final String SSLv2
public static final String SSLv3
public static final String TLS
public static final String TLSv1
public static final String TLSv11
public static final String TLSv12
public static SSLContextBuilder create()
public SSLContextBuilder setProtocol(String protocol)
protocol
- 协议public SSLContextBuilder setTrustManagers(TrustManager... trustManagers)
trustManagers
- TrustManager列表public SSLContextBuilder setKeyManagers(KeyManager... keyManagers)
keyManagers
- JSSE key managerspublic SSLContextBuilder setSecureRandom(SecureRandom secureRandom)
secureRandom
- SecureRandompublic SSLContext build() throws NoSuchAlgorithmException, KeyManagementException
SSLContext
NoSuchAlgorithmException
- 无此算法KeyManagementException
- Key管理异常public SSLContext buildQuietly() throws IORuntimeException
SSLContext
IORuntimeException
- 包装 GeneralSecurityException异常Copyright © 2021. All rights reserved.