public abstract class SslContext
extends java.lang.Object
SSLEngine和SslHandler的工厂的安全套接字协议实现。
在内部,它通过JDK的SSLContext或OpenSSL的SSL_CTX 。
// In your ChannelInitializer:
ChannelPipeline p = channel.pipeline();
SslContext sslCtx = SslContextBuilder.forServer(...).build();
p.addLast("ssl", sslCtx.newHandler(channel.alloc()));
...
// In your ChannelInitializer:
ChannelPipeline p = channel.pipeline();
SslContext sslCtx = SslContextBuilder.forClient().build();
p.addLast("ssl", sslCtx.newHandler(channel.alloc(), host, port));
...
| Modifier | Constructor and Description |
|---|---|
protected |
SslContext()
创建一个新实例(startTls设置为
false )。
|
protected |
SslContext(boolean startTls)
创建一个新的实例。
|
| Modifier and Type | Method and Description |
|---|---|
abstract ApplicationProtocolNegotiator |
applicationProtocolNegotiator()
返回负责协商TLS NPN / ALPN扩展的应用层协议的对象。
|
protected static javax.net.ssl.TrustManagerFactory |
buildTrustManagerFactory(java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory)
已过时。
|
abstract java.util.List<java.lang.String> |
cipherSuites()
按优先顺序返回启用的密码套件列表。
|
static SslProvider |
defaultClientProvider()
返回当前正在使用的默认客户端实现提供程序。
|
static SslProvider |
defaultServerProvider()
返回当前使用的默认服务器端实现提供程序。
|
protected static java.security.spec.PKCS8EncodedKeySpec |
generateKeySpec(char[] password, byte[] key)
为(加密的)私钥生成密钥规范。
|
abstract boolean |
isClient()
当且仅当此上下文用于客户端时才返回
true 。
|
boolean |
isServer()
当且仅当此上下文用于服务器端时才返回
true 。
|
static SslContext |
newClientContext()
已过时。
|
static SslContext |
newClientContext(java.io.File certChainFile)
已过时。
|
static SslContext |
newClientContext(java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory)
已过时。
|
static SslContext |
newClientContext(java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout)
已过时。
|
static SslContext |
newClientContext(java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout)
已过时。
|
static SslContext |
newClientContext(SslProvider provider)
已过时。
|
static SslContext |
newClientContext(SslProvider provider, java.io.File certChainFile)
已过时。
|
static SslContext |
newClientContext(SslProvider provider, java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory)
已过时。
|
static SslContext |
newClientContext(SslProvider provider, java.io.File trustCertCollectionFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.io.File keyCertChainFile, java.io.File keyFile, java.lang.String keyPassword, javax.net.ssl.KeyManagerFactory keyManagerFactory, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout)
已过时。
|
static SslContext |
newClientContext(SslProvider provider, java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout)
已过时。
|
static SslContext |
newClientContext(SslProvider provider, java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout)
已过时。
|
static SslContext |
newClientContext(SslProvider provider, javax.net.ssl.TrustManagerFactory trustManagerFactory)
已过时。
|
static SslContext |
newClientContext(javax.net.ssl.TrustManagerFactory trustManagerFactory)
已过时。
|
abstract javax.net.ssl.SSLEngine |
newEngine(ByteBufAllocator alloc)
创建一个新的
SSLEngine 。
|
abstract javax.net.ssl.SSLEngine |
newEngine(ByteBufAllocator alloc, java.lang.String peerHost, int peerPort)
使用咨询对等信息创建新的
SSLEngine 。
|
SslHandler |
newHandler(ByteBufAllocator alloc)
创建一个新的 SslHandler 。
|
protected SslHandler |
newHandler(ByteBufAllocator alloc, boolean startTls)
创建一个新的SslHandler。
|
SslHandler |
newHandler(ByteBufAllocator alloc, java.lang.String peerHost, int peerPort)
用咨询对等信息创建一个新的 SslHandler 。
|
protected SslHandler |
newHandler(ByteBufAllocator alloc, java.lang.String peerHost, int peerPort, boolean startTls)
创建一个新的SslHandler。
|
static SslContext |
newServerContext(java.io.File certChainFile, java.io.File keyFile)
已过时。
|
static SslContext |
newServerContext(java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword)
已过时。
|
static SslContext |
newServerContext(java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout)
已过时。
|
static SslContext |
newServerContext(java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout)
已过时。
|
static SslContext |
newServerContext(SslProvider provider, java.io.File certChainFile, java.io.File keyFile)
已过时。
|
static SslContext |
newServerContext(SslProvider provider, java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword)
已过时。
|
static SslContext |
newServerContext(SslProvider provider, java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout)
已过时。
|
static SslContext |
newServerContext(SslProvider provider, java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout)
已过时。
|
static SslContext |
newServerContext(SslProvider provider, java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout)
已过时。
|
static SslContext |
newServerContext(SslProvider provider, java.io.File trustCertCollectionFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.io.File keyCertChainFile, java.io.File keyFile, java.lang.String keyPassword, javax.net.ssl.KeyManagerFactory keyManagerFactory, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout)
已过时。
|
java.util.List<java.lang.String> |
nextProtocols()
已过时。
|
abstract long |
sessionCacheSize()
返回用于存储SSL会话对象的缓存大小。
|
abstract javax.net.ssl.SSLSessionContext |
sessionContext()
返回此上下文所持有的
SSLSessionContext对象。
|
abstract long |
sessionTimeout()
以秒为单位返回缓存的SSL会话对象的超时时间。
|
protected SslContext()
false )。
protected SslContext(boolean startTls)
public static SslProvider defaultServerProvider()
SslProvider.OPENSSL如果OpenSSL可用。
SslProvider.JDK否则。
public static SslProvider defaultClientProvider()
SslProvider.OPENSSL如果OpenSSL可用。
SslProvider.JDK否则。
@Deprecated public static SslContext newServerContext(java.io.File certChainFile, java.io.File keyFile) throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
certChainFile - PEM格式的X.509证书链文件
keyFile - PEM格式的PKCS#8私钥文件
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newServerContext(java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword) throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
certChainFile - PEM格式的X.509证书链文件
keyFile - PEM格式的PKCS#8私钥文件
keyPassword -的的密码keyFile 。
null如果它没有密码保护。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newServerContext(java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
certChainFile - PEM格式的X.509证书链文件
keyFile - PEM格式的PKCS#8私钥文件
keyPassword -的的密码keyFile 。
null如果它没有密码保护。
ciphers - 按优先顺序启用的密码套件。
null使用默认密码套件。
nextProtocols - 按优先顺序接受的应用层协议。
null禁用TLS NPN / ALPN扩展。
sessionCacheSize - 用于存储SSL会话对象的缓存大小。
0使用默认值。
sessionTimeout - 高速缓存的SSL会话对象的超时值,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newServerContext(java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
certChainFile - PEM格式的X.509证书链文件
keyFile - PEM格式的PKCS#8私钥文件
keyPassword -的的密码keyFile 。
null如果它没有密码保护。
ciphers - 按优先顺序启用的密码套件。
null使用默认密码套件。
cipherFilter - 适用于所提供的密码列表的过滤器
apn - 提供了一种配置与应用协议协商相关的参数的方法。
sessionCacheSize - 用于存储SSL会话对象的缓存大小。
0使用默认值。
sessionTimeout - 高速缓存的SSL会话对象的超时,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newServerContext(SslProvider provider, java.io.File certChainFile, java.io.File keyFile) throws javax.net.ssl.SSLException
SslContextBuilder替代
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
certChainFile - PEM格式的X.509证书链文件
keyFile - PEM格式的PKCS#8私钥文件
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newServerContext(SslProvider provider, java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword) throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
certChainFile - PEM格式的X.509证书链文件
keyFile - PEM格式的PKCS#8私钥文件
keyPassword -的的密码keyFile 。
null如果它没有密码保护。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newServerContext(SslProvider provider, java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
certChainFile - PEM格式的X.509证书链文件
keyFile - PEM格式的PKCS#8私钥文件
keyPassword -的的密码keyFile 。
null如果它没有密码保护。
ciphers - 按优先顺序启用的密码套件。
null使用默认密码套件。
nextProtocols - 按优先顺序接受的应用层协议。
null禁用TLS NPN / ALPN扩展。
sessionCacheSize - 用于存储SSL会话对象的高速缓存大小。
0使用默认值。
sessionTimeout - 缓存的SSL会话对象的超时,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newServerContext(SslProvider provider, java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder替代
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
certChainFile - PEM格式的X.509证书链文件
keyFile - PEM格式的PKCS#8私钥文件
keyPassword -的的密码keyFile 。
null如果它没有密码保护。
trustManagerFactory -所述TrustManagerFactory ,其提供TrustManager s表示验证从服务器发送来的证书。
null使用默认值。
ciphers - 按照优先顺序启用密码套件。
null使用默认密码套件。
nextProtocols - 按优先顺序接受的应用层协议。
null禁用TLS NPN / ALPN扩展。
sessionCacheSize - 用于存储SSL会话对象的高速缓存大小。
0使用默认值。
sessionTimeout - 高速缓存的SSL会话对象的超时,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newServerContext(SslProvider provider, java.io.File certChainFile, java.io.File keyFile, java.lang.String keyPassword, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
certChainFile - PEM格式的X.509证书链文件
keyFile - PEM格式的PKCS#8私钥文件
keyPassword -的的密码keyFile 。
null如果它没有密码保护。
ciphers - 按优先顺序启用的密码套件。
null使用默认密码套件。
cipherFilter - 适用于所提供的密码列表的过滤器仅在
provider是
SslProvider.JDK时才需要
apn - 提供了一种配置与应用协议协商相关的参数的方法。
sessionCacheSize - 用于存储SSL会话对象的缓存大小。
0使用默认值。
sessionTimeout - 缓存的SSL会话对象的超时值,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newServerContext(SslProvider provider, java.io.File trustCertCollectionFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.io.File keyCertChainFile, java.io.File keyFile, java.lang.String keyPassword, javax.net.ssl.KeyManagerFactory keyManagerFactory, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
trustCertCollectionFile - PEM格式的X.509证书收集文件。
这提供了用于相互认证的证书集合。
null使用系统默认值
trustManagerFactory - TrustManagerFactory提供验证从客户端发送的证书的TrustManager 。
null使用默认值或解析结果trustCertCollectionFile 。
如果provider不是SslProvider.JDK,则忽略此参数。
keyCertChainFile - PEM格式的X.509证书链文件
keyFile - PEM格式的PKCS#8私钥文件
keyPassword -的的密码keyFile 。
null如果它没有密码保护。
keyManagerFactory - KeyManagerFactory提供用于加密发送到客户端的数据的KeyManager 。
null使用默认值或解析结果keyCertChainFile和keyFile 。
如果provider不是SslProvider.JDK,则忽略此参数。
ciphers - 按优先顺序启用的密码套件。
null使用默认密码套件。
cipherFilter - 适用于所提供的密码列表的过滤器仅在
provider是
SslProvider.JDK时才需要
apn - 提供了一种配置与应用程序协议协商相关的参数的方法。
sessionCacheSize - 用于存储SSL会话对象的高速缓存大小。
0使用默认值。
sessionTimeout - 高速缓存的SSL会话对象的超时值,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext() throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(java.io.File certChainFile) throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
certChainFile - PEM格式的X.509证书链文件
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(javax.net.ssl.TrustManagerFactory trustManagerFactory) throws javax.net.ssl.SSLException
SslContextBuilder
SslContext 。
trustManagerFactory -所述TrustManagerFactory ,其提供TrustManager s表示验证从服务器发送来的证书。
null使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory) throws javax.net.ssl.SSLException
SslContextBuilder
SslContext 。
certChainFile - PEM格式的X.509证书链文件。
null使用系统默认值
trustManagerFactory -所述TrustManagerFactory ,其提供TrustManager s表示验证从服务器发送来的证书。
null使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
certChainFile - PEM格式的X.509证书链文件。
null使用系统默认值
trustManagerFactory -所述TrustManagerFactory ,其提供TrustManager s表示验证从服务器发送来的证书。
null使用默认值。
ciphers - 按优先顺序启用的密码套件。
null使用默认密码套件。
nextProtocols - 按优先顺序接受的应用层协议。
null禁用TLS NPN / ALPN扩展。
sessionCacheSize - 用于存储SSL会话对象的缓存大小。
0使用默认值。
sessionTimeout - 缓存的SSL会话对象的超时值,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder取代
SslContext 。
certChainFile - PEM格式的X.509证书链文件。
null使用系统默认值
trustManagerFactory -所述TrustManagerFactory ,其提供TrustManager s表示验证从服务器发送来的证书。
null使用默认值。
ciphers - 按优先顺序启用的密码套件。
null使用默认密码套件。
cipherFilter - 适用于所提供的密码列表的过滤器
apn - 提供配置与应用协议协商相关的参数的方法。
sessionCacheSize - 用于存储SSL会话对象的缓存大小。
0使用默认值。
sessionTimeout - 缓存的SSL会话对象的超时值,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(SslProvider provider) throws javax.net.ssl.SSLException
SslContextBuilder替代
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(SslProvider provider, java.io.File certChainFile) throws javax.net.ssl.SSLException
SslContextBuilder替代
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
certChainFile - PEM格式的X.509证书链文件。
null使用系统默认值
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(SslProvider provider, javax.net.ssl.TrustManagerFactory trustManagerFactory) throws javax.net.ssl.SSLException
SslContextBuilder
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
trustManagerFactory - TrustManagerFactory提供验证从服务器发送的证书的TrustManager 。
null使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(SslProvider provider, java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory) throws javax.net.ssl.SSLException
SslContextBuilder
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
certChainFile - PEM格式的X.509证书链文件。
null使用系统默认值
trustManagerFactory -所述TrustManagerFactory ,其提供TrustManager s表示验证从服务器发送来的证书。
null使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(SslProvider provider, java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.lang.Iterable<java.lang.String> ciphers, java.lang.Iterable<java.lang.String> nextProtocols, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
certChainFile - PEM格式的X.509证书链文件。
null使用系统默认值
trustManagerFactory -所述TrustManagerFactory ,其提供TrustManager s表示验证从服务器发送来的证书。
null使用默认值。
ciphers - 按优先顺序启用的密码套件。
null使用默认密码套件。
nextProtocols - 按优先顺序接受的应用层协议。
null禁用TLS NPN / ALPN扩展。
sessionCacheSize - 用于存储SSL会话对象的高速缓存大小。
0使用默认值。
sessionTimeout - 高速缓存的SSL会话对象的超时,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(SslProvider provider, java.io.File certChainFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder替代
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
certChainFile - PEM格式的X.509证书链文件。
null使用系统默认值
trustManagerFactory - TrustManagerFactory提供验证从服务器发送的证书的TrustManager 。
null使用默认值。
ciphers - 按优先顺序启用的密码套件。
null使用默认密码套件。
cipherFilter - 适用于所提供的密码列表的过滤器
apn - 提供配置与应用程序协议协商相关的参数的方法。
sessionCacheSize - 用于存储SSL会话对象的高速缓存大小。
0使用默认值。
sessionTimeout - 缓存的SSL会话对象的超时,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
@Deprecated public static SslContext newClientContext(SslProvider provider, java.io.File trustCertCollectionFile, javax.net.ssl.TrustManagerFactory trustManagerFactory, java.io.File keyCertChainFile, java.io.File keyFile, java.lang.String keyPassword, javax.net.ssl.KeyManagerFactory keyManagerFactory, java.lang.Iterable<java.lang.String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, long sessionCacheSize, long sessionTimeout) throws javax.net.ssl.SSLException
SslContextBuilder
SslContext 。
provider - 要使用的SslContext实施。
null使用当前的默认值。
trustCertCollectionFile - PEM格式的X.509证书收集文件。
null使用系统默认值
trustManagerFactory -所述TrustManagerFactory ,其提供TrustManager s表示验证从服务器发送来的证书。
null使用默认值或解析结果trustCertCollectionFile 。
如果provider不是SslProvider.JDK,则忽略此参数。
keyCertChainFile - PEM格式的X.509证书链文件。
这为相互认证提供了公钥。
null使用系统默认值
keyFile - PEM格式的PKCS#8私钥文件。
这提供了相互认证的私钥。
null没有相互认证。
keyPassword -的的密码keyFile 。
null如果它没有密码保护。
如果keyFile是null忽略。
keyManagerFactory - KeyManagerFactory提供用于加密发送到服务器的数据的KeyManager 。
null使用缺省值或解析结果keyCertChainFile和keyFile 。
如果provider不是SslProvider.JDK,则忽略此参数。
ciphers - 按优先顺序启用的密码套件。
null使用默认密码套件。
cipherFilter - 适用于所提供的密码列表的过滤器
apn - 提供配置与应用程序协议协商相关的参数的方法。
sessionCacheSize - 用于存储SSL会话对象的高速缓存大小。
0使用默认值。
sessionTimeout - 高速缓存的SSL会话对象的超时值,以秒为单位。
0使用默认值。
SslContext
javax.net.ssl.SSLException
public final boolean isServer()
true 。
public abstract boolean isClient()
true 。
public abstract java.util.List<java.lang.String> cipherSuites()
public abstract long sessionCacheSize()
public abstract long sessionTimeout()
@Deprecated public final java.util.List<java.lang.String> nextProtocols()
applicationProtocolNegotiator() 。
public abstract ApplicationProtocolNegotiator applicationProtocolNegotiator()
public abstract javax.net.ssl.SSLEngine newEngine(ByteBufAllocator alloc)
SSLEngine 。
如果使用SslProvider.OPENSSL_REFCNT ,则该对象必须被释放。 一种方法是将SslHandler换行并将其插入管道中。 见newHandler(ByteBufAllocator) 。
SSLEngine
public abstract javax.net.ssl.SSLEngine newEngine(ByteBufAllocator alloc, java.lang.String peerHost, int peerPort)
SSLEngine 。
如果使用SslProvider.OPENSSL_REFCNT,则必须释放该对象。 一种方法是将SslHandler换行并将其插入管道中。 见newHandler(ByteBufAllocator, String, int) 。
peerHost - 主机的非权威名称
peerPort - 非权威的港口
SSLEngine
public abstract javax.net.ssl.SSLSessionContext sessionContext()
SSLSessionContext对象。
public final SslHandler newHandler(ByteBufAllocator alloc)
SslHandler 。
如果使用SslProvider.OPENSSL_REFCNT ,则返回的SslHandler将释放包装的引擎。 如果返回的SslHandler未被插入到管道中,那么您可能会泄漏本机内存!
请注意 :默认情况下,底层生成的SSLEngine不会启用hostname verification 。 如果您为客户端创建SslHandler并希望获得适当的安全性,我们建议您配置SSLEngine (请参阅SSLParameters.setEndpointIdentificationAlgorithm(String) ):
SSLEngine sslEngine = sslHandler.engine();
SSLParameters sslParameters = sslEngine.getSSLParameters();
// only available since Java 7
sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
sslEngine.setSSLParameters(sslParameters);
底层的SSLEngine可能不遵循SSLEngine规定的限制,这限制了在一个SSL / TLS数据包上进行wrap / unwrap操作。
alloc - 如果SSLEngine支持,则SSLEngine将使用它来分配ByteBuf对象。
SslHandler
protected SslHandler newHandler(ByteBufAllocator alloc, boolean startTls)
public final SslHandler newHandler(ByteBufAllocator alloc, java.lang.String peerHost, int peerPort)
SslHandler 。
如果使用SslProvider.OPENSSL_REFCNT ,则返回的SslHandler将释放包装的引擎。 如果返回的SslHandler未插入管道中,则可能会泄漏本机内存!
注意 :默认情况下,底层生成的SSLEngine不会启用hostname verification 。 如果您为客户端创建SslHandler并希望获得适当的安全性,我们建议您配置SSLEngine (请参阅SSLParameters.setEndpointIdentificationAlgorithm(String) ):
SSLEngine sslEngine = sslHandler.engine();
SSLParameters sslParameters = sslEngine.getSSLParameters();
// only available since Java 7
sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
sslEngine.setSSLParameters(sslParameters);
底层的SSLEngine可能不遵循SSLEngine规定的限制,这限制了在一个SSL / TLS数据包上进行wrap / unwrap操作。
alloc - 如果SSLEngine支持,则SSLEngine将使用它来分配ByteBuf对象。
peerHost - 主机的非权威名称
peerPort - 非权威的港口
SslHandler
protected SslHandler newHandler(ByteBufAllocator alloc, java.lang.String peerHost, int peerPort, boolean startTls)
protected static java.security.spec.PKCS8EncodedKeySpec generateKeySpec(char[] password,
byte[] key)
throws java.io.IOException,
java.security.NoSuchAlgorithmException,
javax.crypto.NoSuchPaddingException,
java.security.spec.InvalidKeySpecException,
java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException
password - 字符,如果
null假定未加密的密钥
key - DER编码的私钥的字节
java.io.IOException - 如果解析
key失败
java.security.NoSuchAlgorithmException - 如果用于加密
key的算法未知
javax.crypto.NoSuchPaddingException - 如果解密算法中指定的填充方案未知
java.security.spec.InvalidKeySpecException - 如果无法生成基于
password的解密密钥
java.security.InvalidKeyException - 如果基于
password的解密密钥不能用于解密
key
java.security.InvalidAlgorithmParameterException - 解密算法参数有问题
@Deprecated
protected static javax.net.ssl.TrustManagerFactory buildTrustManagerFactory(java.io.File certChainFile,
javax.net.ssl.TrustManagerFactory trustManagerFactory)
throws java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException,
java.security.KeyStoreException,
java.io.IOException
TrustManagerFactory 。
certChainFile - 要从中构建的证书文件。
trustManagerFactory -现有
TrustManagerFactory将如果不使用
null 。
TrustManagerFactory其中包含证书
certChainFile
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.security.KeyStoreException
java.io.IOException
Copyright © 2008–2018 The Netty Project. All rights reserved.