java.lang.Object
io.lettuce.core.SslOptions.Builder
- Enclosing class:
- SslOptions
public static class SslOptions.Builder extends Object
Builder for
SslOptions.-
Method Summary
Modifier and Type Method Description SslOptionsbuild()Create a new instance ofSslOptionsSslOptions.BuildercipherSuites(String... cipherSuites)Sets the cipher suites to use.SslOptions.BuilderhandshakeTimeout(Duration timeout)Sets a timeout for the SSL handshake.SslOptions.BuilderjdkSslProvider()Use the JDK SSL provider for SSL connections.SslOptions.BuilderkeyManager(SslOptions.Resource keyCertChain, SslOptions.Resource key, char[] keyPassword)Sets the key and its certificate to use for client authentication.SslOptions.BuilderkeyManager(File keyCertChainFile, File keyFile, char[] keyPassword)Sets the key file and its certificate to use for client authentication.SslOptions.BuilderkeyManager(KeyManagerFactory keyManagerFactory)Sets theKeyManagerFactory.SslOptions.Builderkeystore(SslOptions.Resource resource, char[] keystorePassword)Sets the Java Keystore resource to load client certificates.SslOptions.Builderkeystore(File keystore)Sets the Keystore file to load client certificates.SslOptions.Builderkeystore(File keystore, char[] keystorePassword)Sets the Keystore file to load client certificates.SslOptions.Builderkeystore(URL keystore)Sets the Keystore resource to load client certificates.SslOptions.Builderkeystore(URL keystore, char[] keystorePassword)Sets the Keystore resource to load client certificates.SslOptions.BuilderkeyStoreType(String keyStoreType)Sets the KeyStore type.SslOptions.BuilderopenSslProvider()Use the OpenSSL provider for SSL connections.SslOptions.Builderprotocols(String... protocols)Sets the protocol used for the connection established to Redis Server, such asTLSv1.2, TLSv1.1, TLSv1.SslOptions.BuildersslContext(Consumer<SslContextBuilder> contextBuilderCustomizer)Applies aSslContextBuildercustomizer by callingConsumer.accept(Object)SslOptions.BuildersslParameters(Supplier<SSLParameters> sslParametersSupplier)Configures aSupplierto createSSLParameters.SslOptions.BuildertrustManager(SslOptions.Resource certCollection)Sets the certificate resource to load trusted certificates.SslOptions.BuildertrustManager(File certCollection)Sets the certificate file to load trusted certificates.SslOptions.BuildertrustManager(TrustManagerFactory trustManagerFactory)Sets theTrustManagerFactory.SslOptions.Buildertruststore(SslOptions.Resource resource, char[] truststorePassword)Sets the Truststore resource to load trusted certificates.SslOptions.Buildertruststore(File truststore)Sets the Truststore file to load trusted certificates.SslOptions.Buildertruststore(File truststore, String truststorePassword)Sets the Truststore file to load trusted certificates.SslOptions.Buildertruststore(URL truststore)Sets the Truststore resource to load trusted certificates.SslOptions.Buildertruststore(URL truststore, String truststorePassword)Sets the Truststore resource to load trusted certificates.
-
Method Details
-
cipherSuites
Sets the cipher suites to use.- Parameters:
cipherSuites- cipher suites to use.- Returns:
this- Since:
- 5.3
-
jdkSslProvider
Use the JDK SSL provider for SSL connections.- Returns:
this
-
openSslProvider
Use the OpenSSL provider for SSL connections. The OpenSSL provider requires thenetty-tcnativedependency with the OpenSSL JNI binary.- Returns:
this- Throws:
IllegalStateException- if OpenSSL is not available
-
handshakeTimeout
Sets a timeout for the SSL handshake.- Parameters:
timeout-Duration.- Returns:
this- Since:
- 5.3.2
-
keyStoreType
Sets the KeyStore type. Defaults toKeyStore.getDefaultType()if not set.- Parameters:
keyStoreType- the keystore type to use, must not benull.- Returns:
this- Since:
- 5.3
-
keystore
Sets the Keystore file to load client certificates. The key store file must be supported byKeyStorewhich isKeyStore.getDefaultType()by default. The keystore is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
keystore- the keystore file, must not benull.- Returns:
this- Since:
- 4.4
-
keystore
Sets the Keystore file to load client certificates. The keystore file must be supported byKeyStorewhich isKeyStore.getDefaultType()by default. The keystore is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
keystore- the keystore file, must not benull.keystorePassword- the keystore password. May be empty to omit password and the keystore integrity check.- Returns:
this- Since:
- 4.4
-
keystore
Sets the Keystore resource to load client certificates. The keystore file must be supported byKeyStorewhich isKeyStore.getDefaultType()by default. The keystore is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
keystore- the keystore URL, must not benull.- Returns:
this- Since:
- 4.4
-
keystore
Sets the Keystore resource to load client certificates. The keystore file must be supported byKeyStorewhich isKeyStore.getDefaultType()by default. The keystore is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
keystore- the keystore file, must not benull.- Returns:
this- Since:
- 4.4
-
keyManager
Sets the key file and its certificate to use for client authentication. The key is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
keyCertChainFile- an X.509 certificate chain file in PEM format.keyFile- a PKCS#8 private key file in PEM format.keyPassword- the password of thekeyFile, ornullif it's not password-protected.- Returns:
this- Since:
- 5.3
-
keyManager
public SslOptions.Builder keyManager(SslOptions.Resource keyCertChain, SslOptions.Resource key, char[] keyPassword)Sets the key and its certificate to use for client authentication. The key is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
keyCertChain- anSslOptions.Resourcefor a X.509 certificate chain in PEM format.key- anSslOptions.Resourcefor a PKCS#8 private key in PEM format.keyPassword- the password of thekeyFile, ornullif it's not password-protected.- Returns:
this- Since:
- 5.3
- See Also:
SslOptions.Resource
-
keyManager
Sets theKeyManagerFactory.- Parameters:
keyManagerFactory- theKeyManagerFactoryto use.- Returns:
this- Since:
- 5.3
-
keystore
Sets the Java Keystore resource to load client certificates. The keystore file must be supported byKeyStorewhich isKeyStore.getDefaultType()by default. The keystore is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
resource- the provider that opens aInputStreamto the keystore file, must not benull.keystorePassword- the keystore password. May be empty to omit password and the keystore integrity check.- Returns:
this- Since:
- 5.3
-
protocols
Sets the protocol used for the connection established to Redis Server, such asTLSv1.2, TLSv1.1, TLSv1.- Parameters:
protocols- list of desired protocols to use.- Returns:
this- Since:
- 5.3
-
truststore
Sets the Truststore file to load trusted certificates. The truststore file must be supported byKeyStorewhich isKeyStore.getDefaultType()by default. The truststore is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
truststore- the truststore file, must not benull.- Returns:
this
-
truststore
Sets the Truststore file to load trusted certificates. The truststore file must be supported byKeyStorewhich isKeyStore.getDefaultType()by default. The truststore is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
truststore- the truststore file, must not benull.truststorePassword- the truststore password. May be empty to omit password and the truststore integrity check.- Returns:
this
-
truststore
Sets the Truststore resource to load trusted certificates. The truststore resource must be supported byKeyStorewhich isKeyStore.getDefaultType()by default. The truststore is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
truststore- the truststore file, must not benull.- Returns:
this
-
truststore
Sets the Truststore resource to load trusted certificates. The truststore resource must be supported byKeyStorewhich isKeyStore.getDefaultType()by default. The truststore is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
truststore- the truststore file, must not benull.truststorePassword- the truststore password. May be empty to omit password and the truststore integrity check.- Returns:
this
-
trustManager
Sets the certificate file to load trusted certificates. The file must provide X.509 certificates in PEM format. Certificates are reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
certCollection- the X.509 certificate collection in PEM format.- Returns:
this- Since:
- 5.3
-
trustManager
Sets the certificate resource to load trusted certificates. The file must provide X.509 certificates in PEM format. Certificates are reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
certCollection- the X.509 certificate collection in PEM format.- Returns:
this- Since:
- 5.3
-
trustManager
Sets theTrustManagerFactory.- Parameters:
trustManagerFactory- theTrustManagerFactoryto use.- Returns:
this- Since:
- 5.3
-
truststore
Sets the Truststore resource to load trusted certificates. The truststore resource must be supported byKeyStorewhich isKeyStore.getDefaultType()by default. The truststore is reloaded on each connection attempt that allows to replace certificates during runtime.- Parameters:
resource- the provider that opens aInputStreamto the keystore file, must not benull.truststorePassword- the truststore password. May be empty to omit password and the truststore integrity check.- Returns:
this
-
sslContext
Applies aSslContextBuildercustomizer by callingConsumer.accept(Object)- Parameters:
contextBuilderCustomizer- builder callback to customize theSslContextBuilder.- Returns:
this- Since:
- 5.3
-
sslParameters
Configures aSupplierto createSSLParameters.- Parameters:
sslParametersSupplier-SupplierforSSLParameters.- Returns:
this- Since:
- 5.3
-
build
Create a new instance ofSslOptions- Returns:
- new instance of
SslOptions
-