Package io.netty.handler.codec.quic
Class QuicSslContextBuilder
- java.lang.Object
-
- io.netty.handler.codec.quic.QuicSslContextBuilder
-
public final class QuicSslContextBuilder extends java.lang.Object
Builder for configuring a new SslContext for creation.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description QuicSslContextBuilder
applicationProtocols(java.lang.String @Nullable ... applicationProtocols)
Application protocol negotiation configuration.QuicSslContext
build()
Create newQuicSslContext
instance with configured settings that can be used forQUIC
.static QuicSslContext
buildForServerWithSni(Mapping<? super java.lang.String,? extends QuicSslContext> mapping)
Enables support for SNI on the server side.QuicSslContextBuilder
clientAuth(ClientAuth clientAuth)
Sets the client authentication mode.QuicSslContextBuilder
earlyData(boolean enabled)
Enable / disable the usage of early data.static QuicSslContextBuilder
forClient()
Creates a builder for new client-sideQuicSslContext
that can be used forQUIC
.static QuicSslContextBuilder
forServer(java.io.File keyFile, @Nullable java.lang.String keyPassword, java.io.File certChainFile)
Creates a builder for new server-sideQuicSslContext
that can be used forQUIC
.static QuicSslContextBuilder
forServer(java.security.PrivateKey key, @Nullable java.lang.String keyPassword, java.security.cert.X509Certificate... certChain)
Creates a builder for new server-sideQuicSslContext
that can be used forQUIC
.static QuicSslContextBuilder
forServer(javax.net.ssl.KeyManagerFactory keyManagerFactory, @Nullable java.lang.String password)
Creates a builder for new server-sideQuicSslContext
that can be used forQUIC
.static QuicSslContextBuilder
forServer(javax.net.ssl.KeyManager keyManager, @Nullable java.lang.String keyPassword)
QuicSslContextBuilder
keylog(boolean enabled)
Enable / disable keylog.QuicSslContextBuilder
keylog(@Nullable BoringSSLKeylog keylog)
Enable / disable keylog.QuicSslContextBuilder
keyManager(@Nullable java.io.File keyFile, @Nullable java.lang.String keyPassword, @Nullable java.io.File keyCertChainFile)
Identifying certificate for this host.QuicSslContextBuilder
keyManager(@Nullable java.security.PrivateKey key, @Nullable java.lang.String keyPassword, java.security.cert.X509Certificate @Nullable ... certChain)
Identifying certificate for this host.QuicSslContextBuilder
keyManager(@Nullable javax.net.ssl.KeyManagerFactory keyManagerFactory, @Nullable java.lang.String keyPassword)
Identifying manager for this host.QuicSslContextBuilder
keyManager(javax.net.ssl.KeyManager keyManager, @Nullable java.lang.String password)
A single key manager managing the identity information of this host.<T> QuicSslContextBuilder
option(SslContextOption<T> option, T value)
Configure aSslContextOption
.QuicSslContextBuilder
sessionCacheSize(long sessionCacheSize)
Set the size of the cache used for storing SSL session objects.QuicSslContextBuilder
sessionTimeout(long sessionTimeout)
Set the timeout for the cached SSL session objects, in seconds.QuicSslContextBuilder
trustManager(@Nullable java.io.File trustCertCollectionFile)
Trusted certificates for verifying the remote endpoint's certificate.QuicSslContextBuilder
trustManager(@Nullable javax.net.ssl.TrustManagerFactory trustManagerFactory)
Trusted manager for verifying the remote endpoint's certificate.QuicSslContextBuilder
trustManager(java.security.cert.X509Certificate @Nullable ... trustCertCollection)
Trusted certificates for verifying the remote endpoint's certificate.QuicSslContextBuilder
trustManager(javax.net.ssl.TrustManager trustManager)
A single trusted manager for verifying the remote endpoint's certificate.
-
-
-
Method Detail
-
forClient
public static QuicSslContextBuilder forClient()
Creates a builder for new client-sideQuicSslContext
that can be used forQUIC
.
-
forServer
public static QuicSslContextBuilder forServer(java.io.File keyFile, @Nullable @Nullable java.lang.String keyPassword, java.io.File certChainFile)
Creates a builder for new server-sideQuicSslContext
that can be used forQUIC
.- Parameters:
keyFile
- a PKCS#8 private key file in PEM formatkeyPassword
- the password of thekeyFile
, ornull
if it's not password-protectedcertChainFile
- an X.509 certificate chain file in PEM format- See Also:
keyManager(File, String, File)
-
forServer
public static QuicSslContextBuilder forServer(java.security.PrivateKey key, @Nullable @Nullable java.lang.String keyPassword, java.security.cert.X509Certificate... certChain)
Creates a builder for new server-sideQuicSslContext
that can be used forQUIC
.- Parameters:
key
- a PKCS#8 private keykeyPassword
- the password of thekeyFile
, ornull
if it's not password-protectedcertChain
- the X.509 certificate chain- See Also:
keyManager(File, String, File)
-
forServer
public static QuicSslContextBuilder forServer(javax.net.ssl.KeyManagerFactory keyManagerFactory, @Nullable @Nullable java.lang.String password)
Creates a builder for new server-sideQuicSslContext
that can be used forQUIC
.- Parameters:
keyManagerFactory
- non-null
factory for server's private key- See Also:
keyManager(KeyManagerFactory, String)
-
forServer
public static QuicSslContextBuilder forServer(javax.net.ssl.KeyManager keyManager, @Nullable @Nullable java.lang.String keyPassword)
- Parameters:
keyManager
- non-null
KeyManager for server's private keykeyPassword
- the password of thekeyFile
, ornull
if it's not password-protected
-
buildForServerWithSni
public static QuicSslContext buildForServerWithSni(Mapping<? super java.lang.String,? extends QuicSslContext> mapping)
Enables support for SNI on the server side.- Parameters:
mapping
- theMapping
that is used to map names to theQuicSslContext
to use. Usually usingDomainWildcardMappingBuilder
should be used to create theMapping
.
-
option
public <T> QuicSslContextBuilder option(SslContextOption<T> option, T value)
Configure aSslContextOption
.
-
earlyData
public QuicSslContextBuilder earlyData(boolean enabled)
Enable / disable the usage of early data.
-
keylog
public QuicSslContextBuilder keylog(boolean enabled)
Enable / disable keylog. When enabled, TLS keys are logged to an internal logger named "io.netty.handler.codec.quic.BoringSSLLogginKeylog" with DEBUG level, seeBoringSSLKeylog
for detail, logging keys are following NSS Key Log Format. This is intended for debugging use with tools like Wireshark.
-
keylog
public QuicSslContextBuilder keylog(@Nullable @Nullable BoringSSLKeylog keylog)
Enable / disable keylog. When enabled, TLS keys are logged toBoringSSLKeylog.logKey(SSLEngine, String)
logging keys are following NSS Key Log Format. This is intended for debugging use with tools like Wireshark.
-
trustManager
public QuicSslContextBuilder trustManager(@Nullable @Nullable java.io.File trustCertCollectionFile)
Trusted certificates for verifying the remote endpoint's certificate. The file should contain an X.509 certificate collection in PEM format.null
uses the system default which only works with Java 8u261 and later as these versions support TLS1.3, see JDK 8u261 Update Release Notes
-
trustManager
public QuicSslContextBuilder trustManager(java.security.cert.X509Certificate @Nullable ... trustCertCollection)
Trusted certificates for verifying the remote endpoint's certificate.null
uses the system default which only works with Java 8u261 and later as these versions support TLS1.3, see JDK 8u261 Update Release Notes
-
trustManager
public QuicSslContextBuilder trustManager(@Nullable @Nullable javax.net.ssl.TrustManagerFactory trustManagerFactory)
Trusted manager for verifying the remote endpoint's certificate.null
uses the system default which only works with Java 8u261 and later as these versions support TLS1.3, see JDK 8u261 Update Release Notes
-
trustManager
public QuicSslContextBuilder trustManager(javax.net.ssl.TrustManager trustManager)
A single trusted manager for verifying the remote endpoint's certificate. This is helpful when custom implementation ofTrustManager
is needed. Internally, a simple wrapper ofTrustManagerFactory
that only produces this specifiedTrustManager
will be created, thus all the requirements specified intrustManager(TrustManagerFactory trustManagerFactory)
also apply here.
-
keyManager
public QuicSslContextBuilder keyManager(@Nullable @Nullable java.io.File keyFile, @Nullable @Nullable java.lang.String keyPassword, @Nullable @Nullable java.io.File keyCertChainFile)
Identifying certificate for this host.keyCertChainFile
andkeyFile
may benull
for client contexts, which disables mutual authentication.- Parameters:
keyFile
- a PKCS#8 private key file in PEM formatkeyPassword
- the password of thekeyFile
, ornull
if it's not password-protectedkeyCertChainFile
- an X.509 certificate chain file in PEM format
-
keyManager
public QuicSslContextBuilder keyManager(@Nullable @Nullable java.security.PrivateKey key, @Nullable @Nullable java.lang.String keyPassword, java.security.cert.X509Certificate @Nullable ... certChain)
Identifying certificate for this host.keyCertChain
andkey
may benull
for client contexts, which disables mutual authentication.- Parameters:
key
- a PKCS#8 private key filekeyPassword
- the password of thekey
, ornull
if it's not password-protectedcertChain
- an X.509 certificate chain
-
keyManager
public QuicSslContextBuilder keyManager(@Nullable @Nullable javax.net.ssl.KeyManagerFactory keyManagerFactory, @Nullable @Nullable java.lang.String keyPassword)
Identifying manager for this host.keyManagerFactory
may benull
for client contexts, which disables mutual authentication.
-
keyManager
public QuicSslContextBuilder keyManager(javax.net.ssl.KeyManager keyManager, @Nullable @Nullable java.lang.String password)
A single key manager managing the identity information of this host. This is helpful when custom implementation ofKeyManager
is needed. Internally, a wrapper ofKeyManagerFactory
that only produces this specifiedKeyManager
will be created, thus all the requirements specified inkeyManager(KeyManagerFactory, String)
also apply here.
-
applicationProtocols
public QuicSslContextBuilder applicationProtocols(java.lang.String @Nullable ... applicationProtocols)
Application protocol negotiation configuration.null
disables support.
-
sessionCacheSize
public QuicSslContextBuilder sessionCacheSize(long sessionCacheSize)
Set the size of the cache used for storing SSL session objects.0
to use the default value.
-
sessionTimeout
public QuicSslContextBuilder sessionTimeout(long sessionTimeout)
Set the timeout for the cached SSL session objects, in seconds.0
to use the default value.
-
clientAuth
public QuicSslContextBuilder clientAuth(ClientAuth clientAuth)
Sets the client authentication mode.
-
build
public QuicSslContext build()
Create newQuicSslContext
instance with configured settings that can be used forQUIC
.
-
-