Top Description Inners Fields Constructors Methods
io.netty5.handler.ssl

public Class JdkSslContext

extends SslContext
Class Inheritance
Known Direct Subclasses
io.netty5.handler.ssl.JdkSslServerContext, io.netty5.handler.ssl.JdkSslClientContext
Imports
io.netty5.buffer.BufferAllocator, io.netty5.util.internal.EmptyArrays, io.netty5.util.internal.logging.InternalLogger, .InternalLoggerFactory, javax.crypto.NoSuchPaddingException, javax.net.ssl.KeyManagerFactory, .SSLContext, .SSLEngine, .SSLSessionContext, java.io.File, .IOException, java.security.InvalidAlgorithmParameterException, .KeyException, .KeyStore, .KeyStoreException, .NoSuchAlgorithmException, .Provider, .Security, .UnrecoverableKeyException, java.security.cert.CertificateException, java.security.spec.InvalidKeySpecException, java.util.ArrayList, .Arrays, .Collections, .HashSet, .LinkedHashSet, .List, .Set

An SslContext which uses JDK's SSL/TLS implementation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final JdkApplicationProtocolNegotiator
apn

Deprecated as a consequence of JdkApplicationProtocolNegotiator being deprecated.
private final String[]
private final ClientAuth
private static final List<String>
private static final List<String>
private static final String[]
private static final Provider
private final boolean
private static final InternalLogger
pack-priv static final String
private final String[]
private final SSLContext
private static final Set<String>
private static final Set<String>
private final List<String>
Inherited from io.netty5.handler.ssl.SslContext:
ALIASX509_CERT_FACTORY

Constructor Summary

AccessConstructor and Description
public
JdkSslContext(SSLContext
the SSLContext to use.
sslContext
,
boolean
true if this context should create SSLEngines for client-side usage.
isClient
,
ClientAuth
the ClientAuth to use. This will only be used when {@param isClient} is false.
clientAuth
)

Creates a new JdkSslContext from a pre-configured SSLContext.
public
JdkSslContext(SSLContext
the SSLContext to use.
sslContext
,
boolean
true if this context should create SSLEngines for client-side usage.
isClient
,
Iterable<String>
the ciphers to use or null if the standard should be used.
ciphers
,
CipherSuiteFilter
the filter to use.
cipherFilter
,
ApplicationProtocolConfig apn, ClientAuth
the ClientAuth to use. This will only be used when {@param isClient} is false.
clientAuth
)

Creates a new JdkSslContext from a pre-configured SSLContext.
public
JdkSslContext(SSLContext
the SSLContext to use.
sslContext
,
boolean
true if this context should create SSLEngines for client-side usage.
isClient
,
Iterable<String>
the ciphers to use or null if the standard should be used.
ciphers
,
CipherSuiteFilter
the filter to use.
cipherFilter
,
ApplicationProtocolConfig apn, ClientAuth
the ClientAuth to use. This will only be used when {@param isClient} is false.
clientAuth
,
String[]
the protocols to enable, or null to enable the default protocols.
protocols
,
boolean
true if the first write request shouldn't be encrypted
startTls
)

Creates a new JdkSslContext from a pre-configured SSLContext.

pack-priv
JdkSslContext(SSLContext sslContext, boolean isClient, Iterable<String> ciphers, CipherSuiteFilter cipherFilter, JdkApplicationProtocolNegotiator apn, ClientAuth clientAuth, String[] protocols, boolean startTls)

Deprecated as a consequence of JdkApplicationProtocolNegotiator being deprecated.

Method Summary

Modifier and TypeMethod and Description
public final JdkApplicationProtocolNegotiator
applicationProtocolNegotiator()

Implements abstract io.netty5.handler.ssl.SslContext.applicationProtocolNegotiator.

Deprecated as a consequence of JdkApplicationProtocolNegotiator being deprecated.
Returns the object responsible for negotiating application layer protocols for the TLS NPN/ALPN extensions.
pack-priv static KeyManagerFactory

Returns:

A KeyManagerFactory based upon a key file, key file password, and a certificate chain.
buildKeyManagerFactory
(File
an X.509 certificate chain file in PEM format
certChainFile
,
File
a PKCS#8 private key file in PEM format
keyFile
,
String
the password of the keyFile. null if it's not password-protected.
keyPassword
,
KeyManagerFactory
The existing KeyManagerFactory that will be used if not null
kmf
,
String
the KeyStore that should be used in the KeyManagerFactory
keyStore
)

Build a KeyManagerFactory based upon a key file, key file password, and a certificate chain.

protected static KeyManagerFactory

Returns:

A KeyManagerFactory based upon a key file, key file password, and a certificate chain.
buildKeyManagerFactory
(File
an X.509 certificate chain file in PEM format
certChainFile
,
File
a PKCS#8 private key file in PEM format
keyFile
,
String
the password of the keyFile. null if it's not password-protected.
keyPassword
,
KeyManagerFactory
The existing KeyManagerFactory that will be used if not null
kmf
)

Deprecated will be removed.
Build a KeyManagerFactory based upon a key file, key file password, and a certificate chain.
pack-priv static KeyManagerFactory

Returns:

A KeyManagerFactory based upon a key algorithm, key file, key file password, and a certificate chain.
buildKeyManagerFactory
(File
an X.509 certificate chain file in PEM format
certChainFile
,
String
the standard name of the requested algorithm. See the Java Secure Socket Extension Reference Guide for information about standard algorithm names.
keyAlgorithm
,
File
a PKCS#8 private key file in PEM format
keyFile
,
String
the password of the keyFile. null if it's not password-protected.
keyPassword
,
KeyManagerFactory
The existing KeyManagerFactory that will be used if not null
kmf
,
String
the KeyStore that should be used in the KeyManagerFactory
keyStore
)

Build a KeyManagerFactory based upon a key algorithm, key file, key file password, and a certificate chain.

protected static KeyManagerFactory

Returns:

A KeyManagerFactory based upon a key algorithm, key file, key file password, and a certificate chain.
buildKeyManagerFactory
(File
an buildKeyManagerFactory X.509 certificate chain file in PEM format
certChainFile
,
String
the standard name of the requested algorithm. See the Java Secure Socket Extension Reference Guide for information about standard algorithm names.
keyAlgorithm
,
File
a PKCS#8 private key file in PEM format
keyFile
,
String
the password of the keyFile. null if it's not password-protected.
keyPassword
,
KeyManagerFactory
The existing KeyManagerFactory that will be used if not null
kmf
)

Deprecated will be removed.
Build a KeyManagerFactory based upon a key algorithm, key file, key file password, and a certificate chain.
public final List<String>
cipherSuites()

Implements abstract io.netty5.handler.ssl.SslContext.cipherSuites.

Returns the list of enabled cipher suites, in the order of preference.
private SSLEngine
public final SSLContext
context()

Returns the JDK SSLContext object held by this context.

private static List<String>
defaultCiphers(SSLEngine engine, Set<String> supportedCiphers)

private static String[]
public final boolean
isClient()

Implements abstract io.netty5.handler.ssl.SslContext.isClient.

Returns the true if and only if this context is for client-side.
private static boolean
public final SSLEngine
public final SSLEngine
newEngine(BufferAllocator alloc, String
the non-authoritative name of the host
peerHost
,
int
the non-authoritative port
peerPort
)

Implements abstract io.netty5.handler.ssl.SslContext.newEngine.

Creates a new SSLEngine using advisory peer information.
public final SSLSessionContext
sessionContext()

Implements abstract io.netty5.handler.ssl.SslContext.sessionContext.

Returns the JDK SSLSessionContext object held by this context.
private static Set<String>
pack-priv static JdkApplicationProtocolNegotiator

Returns:

The results of the translation
toNegotiator
(ApplicationProtocolConfig
The configuration which defines the translation
config
,
boolean
true if a server false otherwise.
isServer
)

Deprecated as a consequence of JdkApplicationProtocolNegotiator being deprecated.
Translate a ApplicationProtocolConfig object to a JdkApplicationProtocolNegotiator object.
Inherited from io.netty5.handler.ssl.SslContext:
attributesbuildKeyManagerFactorybuildKeyManagerFactorybuildKeyStorebuildTrustManagerFactorybuildTrustManagerFactorybuildTrustManagerFactorydefaultClientProviderdefaultServerProvidergenerateKeySpecisServerkeyStorePasswordnewClientContextnewClientContextnewClientContextnewClientContextnewClientContextnewClientContextnewClientContextnewClientContextnewClientContextnewClientContextnewClientContextnewClientContextnewClientContextnewClientContextInternalnewHandlernewHandlernewHandlernewHandlernewHandlernewHandlernewHandlernewHandlernewServerContextnewServerContextnewServerContextnewServerContextnewServerContextnewServerContextnewServerContextnewServerContextnewServerContextnewServerContextnewServerContextnewServerContextInternalnextProtocolssessionCacheSizesessionTimeouttoApplicationProtocolConfigtoPrivateKeytoPrivateKeytoPrivateKeyInternaltoX509CertificatestoX509CertificatestoX509CertificatesInternal

Field Detail

apnback to summary
private final JdkApplicationProtocolNegotiator apn

Deprecated

as a consequence of JdkApplicationProtocolNegotiator being deprecated. See corresponding docs for further information.

Annotations
@SuppressWarnings:deprecation
cipherSuitesback to summary
private final String[] cipherSuites
clientAuthback to summary
private final ClientAuth clientAuth
DEFAULT_CIPHERSback to summary
private static final List<String> DEFAULT_CIPHERS
DEFAULT_CIPHERS_NON_TLSV13back to summary
private static final List<String> DEFAULT_CIPHERS_NON_TLSV13
DEFAULT_PROTOCOLSback to summary
private static final String[] DEFAULT_PROTOCOLS
DEFAULT_PROVIDERback to summary
private static final Provider DEFAULT_PROVIDER
isClientback to summary
private final boolean isClient
loggerback to summary
private static final InternalLogger logger
PROTOCOLback to summary
pack-priv static final String PROTOCOL
protocolsback to summary
private final String[] protocols
sslContextback to summary
private final SSLContext sslContext
SUPPORTED_CIPHERSback to summary
private static final Set<String> SUPPORTED_CIPHERS
SUPPORTED_CIPHERS_NON_TLSV13back to summary
private static final Set<String> SUPPORTED_CIPHERS_NON_TLSV13
unmodifiableCipherSuitesback to summary
private final List<String> unmodifiableCipherSuites

Constructor Detail

JdkSslContextback to summary
public JdkSslContext(SSLContext sslContext, boolean isClient, ClientAuth clientAuth) throws Exception

Creates a new JdkSslContext from a pre-configured SSLContext.

Parameters
sslContext:SSLContext

the SSLContext to use.

isClient:boolean

true if this context should create SSLEngines for client-side usage.

clientAuth:ClientAuth

the ClientAuth to use. This will only be used when {@param isClient} is false.

Annotations
@Deprecated
JdkSslContextback to summary
public JdkSslContext(SSLContext sslContext, boolean isClient, Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, ClientAuth clientAuth) throws Exception

Creates a new JdkSslContext from a pre-configured SSLContext.

Parameters
sslContext:SSLContext

the SSLContext to use.

isClient:boolean

true if this context should create SSLEngines for client-side usage.

ciphers:Iterable<String>

the ciphers to use or null if the standard should be used.

cipherFilter:CipherSuiteFilter

the filter to use.

apn:ApplicationProtocolConfig

the ApplicationProtocolConfig to use.

clientAuth:ClientAuth

the ClientAuth to use. This will only be used when {@param isClient} is false.

Annotations
@Deprecated
JdkSslContextback to summary
public JdkSslContext(SSLContext sslContext, boolean isClient, Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn, ClientAuth clientAuth, String[] protocols, boolean startTls) throws Exception

Creates a new JdkSslContext from a pre-configured SSLContext.

Parameters
sslContext:SSLContext

the SSLContext to use.

isClient:boolean

true if this context should create SSLEngines for client-side usage.

ciphers:Iterable<String>

the ciphers to use or null if the standard should be used.

cipherFilter:CipherSuiteFilter

the filter to use.

apn:ApplicationProtocolConfig

the ApplicationProtocolConfig to use.

clientAuth:ClientAuth

the ClientAuth to use. This will only be used when {@param isClient} is false.

protocols:String[]

the protocols to enable, or null to enable the default protocols.

startTls:boolean

true if the first write request shouldn't be encrypted

JdkSslContextback to summary
pack-priv JdkSslContext(SSLContext sslContext, boolean isClient, Iterable<String> ciphers, CipherSuiteFilter cipherFilter, JdkApplicationProtocolNegotiator apn, ClientAuth clientAuth, String[] protocols, boolean startTls) throws Exception

Deprecated

as a consequence of JdkApplicationProtocolNegotiator being deprecated. See corresponding docs for further information.

Annotations
@SuppressWarnings:deprecation

Method Detail

applicationProtocolNegotiatorback to summary
public final JdkApplicationProtocolNegotiator applicationProtocolNegotiator()

Implements abstract io.netty5.handler.ssl.SslContext.applicationProtocolNegotiator.

Doc from io.netty5.handler.ssl.SslContext.applicationProtocolNegotiator.

Deprecated

as a consequence of JdkApplicationProtocolNegotiator being deprecated. See corresponding docs for further information.

Returns the object responsible for negotiating application layer protocols for the TLS NPN/ALPN extensions.

Annotations
@Override
buildKeyManagerFactoryback to summary
pack-priv static KeyManagerFactory buildKeyManagerFactory(File certChainFile, File keyFile, String keyPassword, KeyManagerFactory kmf, String keyStore) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, CertificateException, KeyException, IOException

Build a KeyManagerFactory based upon a key file, key file password, and a certificate chain.

Parameters
certChainFile:File

an X.509 certificate chain file in PEM format

keyFile:File

a PKCS#8 private key file in PEM format

keyPassword:String

the password of the keyFile. null if it's not password-protected.

kmf:KeyManagerFactory

The existing KeyManagerFactory that will be used if not null

keyStore:String

the KeyStore that should be used in the KeyManagerFactory

Returns:KeyManagerFactory

A KeyManagerFactory based upon a key file, key file password, and a certificate chain.

buildKeyManagerFactoryback to summary
protected static KeyManagerFactory buildKeyManagerFactory(File certChainFile, File keyFile, String keyPassword, KeyManagerFactory kmf) throws UnrecoverableKeyException, KeyStoreException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, CertificateException, KeyException, IOException

Deprecated

will be removed.

Build a KeyManagerFactory based upon a key file, key file password, and a certificate chain.

Parameters
certChainFile:File

an X.509 certificate chain file in PEM format

keyFile:File

a PKCS#8 private key file in PEM format

keyPassword:String

the password of the keyFile. null if it's not password-protected.

kmf:KeyManagerFactory

The existing KeyManagerFactory that will be used if not null

Returns:KeyManagerFactory

A KeyManagerFactory based upon a key file, key file password, and a certificate chain.

Annotations
@Deprecated
buildKeyManagerFactoryback to summary
pack-priv static KeyManagerFactory buildKeyManagerFactory(File certChainFile, String keyAlgorithm, File keyFile, String keyPassword, KeyManagerFactory kmf, String keyStore) throws KeyStoreException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, IOException, CertificateException, KeyException, UnrecoverableKeyException

Build a KeyManagerFactory based upon a key algorithm, key file, key file password, and a certificate chain.

Parameters
certChainFile:File

an X.509 certificate chain file in PEM format

keyAlgorithm:String

the standard name of the requested algorithm. See the Java Secure Socket Extension Reference Guide for information about standard algorithm names.

keyFile:File

a PKCS#8 private key file in PEM format

keyPassword:String

the password of the keyFile. null if it's not password-protected.

kmf:KeyManagerFactory

The existing KeyManagerFactory that will be used if not null

keyStore:String

the KeyStore that should be used in the KeyManagerFactory

Returns:KeyManagerFactory

A KeyManagerFactory based upon a key algorithm, key file, key file password, and a certificate chain.

buildKeyManagerFactoryback to summary
protected static KeyManagerFactory buildKeyManagerFactory(File certChainFile, String keyAlgorithm, File keyFile, String keyPassword, KeyManagerFactory kmf) throws KeyStoreException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeySpecException, InvalidAlgorithmParameterException, IOException, CertificateException, KeyException, UnrecoverableKeyException

Deprecated

will be removed.

Build a KeyManagerFactory based upon a key algorithm, key file, key file password, and a certificate chain.

Parameters
certChainFile:File

an buildKeyManagerFactory X.509 certificate chain file in PEM format

keyAlgorithm:String

the standard name of the requested algorithm. See the Java Secure Socket Extension Reference Guide for information about standard algorithm names.

keyFile:File

a PKCS#8 private key file in PEM format

keyPassword:String

the password of the keyFile. null if it's not password-protected.

kmf:KeyManagerFactory

The existing KeyManagerFactory that will be used if not null

Returns:KeyManagerFactory

A KeyManagerFactory based upon a key algorithm, key file, key file password, and a certificate chain.

Annotations
@Deprecated
cipherSuitesback to summary
public final List<String> cipherSuites()

Implements abstract io.netty5.handler.ssl.SslContext.cipherSuites.

Doc from io.netty5.handler.ssl.SslContext.cipherSuites.

Returns the list of enabled cipher suites, in the order of preference.

Annotations
@Override
configureAndWrapEngineback to summary
private SSLEngine configureAndWrapEngine(SSLEngine engine, BufferAllocator alloc)
Annotations
@SuppressWarnings:deprecation
contextback to summary
public final SSLContext context()

Returns the JDK SSLContext object held by this context.

defaultCiphersback to summary
private static List<String> defaultCiphers(SSLEngine engine, Set<String> supportedCiphers)
defaultProtocolsback to summary
private static String[] defaultProtocols(SSLContext context, SSLEngine engine)
isClientback to summary
public final boolean isClient()

Implements abstract io.netty5.handler.ssl.SslContext.isClient.

Doc from io.netty5.handler.ssl.SslContext.isClient.

Returns the true if and only if this context is for client-side.

Annotations
@Override
isTlsV13Supportedback to summary
private static boolean isTlsV13Supported(String[] protocols)
newEngineback to summary
public final SSLEngine newEngine(BufferAllocator alloc)

Implements abstract io.netty5.handler.ssl.SslContext.newEngine.

Doc from io.netty5.handler.ssl.SslContext.newEngine.

Creates a new SSLEngine.

If SslProvider#OPENSSL_REFCNT is used then the object must be released. One way to do this is to wrap in a SslHandler and insert it into a pipeline. See newHandler(BufferAllocator).

Returns:SSLEngine

a new SSLEngine

Annotations
@Override
newEngineback to summary
public final SSLEngine newEngine(BufferAllocator alloc, String peerHost, int peerPort)

Implements abstract io.netty5.handler.ssl.SslContext.newEngine.

Doc from io.netty5.handler.ssl.SslContext.newEngine.

Creates a new SSLEngine using advisory peer information.

If SslProvider#OPENSSL_REFCNT is used then the object must be released. One way to do this is to wrap in a SslHandler and insert it into a pipeline. See newHandler(BufferAllocator, String, int).

Parameters
peerHost:String

the non-authoritative name of the host

peerPort:int

the non-authoritative port

Returns:SSLEngine

a new SSLEngine

Annotations
@Override
sessionContextback to summary
public final SSLSessionContext sessionContext()

Implements abstract io.netty5.handler.ssl.SslContext.sessionContext.

Returns the JDK SSLSessionContext object held by this context.

Annotations
@Override
supportedCiphersback to summary
private static Set<String> supportedCiphers(SSLEngine engine)
toNegotiatorback to summary
pack-priv static JdkApplicationProtocolNegotiator toNegotiator(ApplicationProtocolConfig config, boolean isServer)

Deprecated

as a consequence of JdkApplicationProtocolNegotiator being deprecated. See corresponding docs for further information.

Translate a ApplicationProtocolConfig object to a JdkApplicationProtocolNegotiator object.

Parameters
config:ApplicationProtocolConfig

The configuration which defines the translation

isServer:boolean

true if a server false otherwise.

Returns:JdkApplicationProtocolNegotiator

The results of the translation

Annotations
@SuppressWarnings:deprecation
io.netty5.handler.ssl back to summary

private final Class JdkSslContext.Defaults

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv List<String>
pack-priv List<String>
pack-priv String[]
pack-priv Provider
pack-priv Set<String>
pack-priv Set<String>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv void
init()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultCiphersback to summary
pack-priv List<String> defaultCiphers
defaultCiphersNonTLSv13back to summary
pack-priv List<String> defaultCiphersNonTLSv13
defaultProtocolsback to summary
pack-priv String[] defaultProtocols
defaultProviderback to summary
pack-priv Provider defaultProvider
supportedCiphersback to summary
pack-priv Set<String> supportedCiphers
supportedCiphersNonTLSv13back to summary
pack-priv Set<String> supportedCiphersNonTLSv13

Constructor Detail

Defaultsback to summary
private Defaults()

Method Detail

initback to summary
pack-priv void init()