public class SslOptions
extends java.lang.Object
Recommended entry point for enabling TLS.
SslVerifyMode:
SslVerifyMode.FULL (default) - verifies the certificate chain against the truststore
and verifies that the server hostname matches the certificate (HTTPS endpoint
identification). Recommended for production.SslVerifyMode.CA - verifies the certificate chain against the truststore but
skips hostname verification. Useful when connecting via IP or a name not listed in the
certificate's SAN/CN.SslVerifyMode.INSECURE - disables all certificate and hostname verification. Do NOT
use in production.cacerts) is used. Custom
truststores can be provided .
SslOptions sslOptions = SslOptions.defaults();
Custom truststore:
SslOptions sslOptions = SslOptions.builder()
.truststore(new File("/path/to/truststore.p12"), "changeit".toCharArray())
.build();
Mutual TLS (client certificate):
SslOptions sslOptions = SslOptions.builder()
.keystore(new File("/path/to/keystore.p12"), "changeit".toCharArray())
.truststore(new File("/path/to/truststore.p12"), "changeit".toCharArray())
.build();
Use with a client:
JedisClientConfig config = DefaultJedisClientConfig.builder()
.sslOptions(sslOptions)
.build();
RedisClient client = RedisClient.builder()
.hostAndPort("redis.example.com", 6379)
.clientConfig(config)
.build();
SslVerifyMode,
JedisClientConfig.getSslOptions()| Modifier and Type | Class and Description |
|---|---|
static class |
SslOptions.Builder
Builder for
SslOptions. |
static interface |
SslOptions.Resource
Supplier for a
InputStream representing a resource. |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertFile(java.lang.String keyword,
java.io.File file)
Assert that
file exists. |
static SslOptions.Builder |
builder()
Returns a new
SslOptions.Builder to construct SslOptions. |
javax.net.ssl.SSLContext |
createSslContext()
A
SSLContext object that is configured with values from this SslOptions object. |
static SslOptions |
defaults()
Returns
SslOptions with default settings: JVM truststore, TLS protocol and full
certificate and hostname verification (SslVerifyMode.FULL). |
javax.net.ssl.SSLParameters |
getSslParameters()
createSslContext() must be called before this. |
SslVerifyMode |
getSslVerifyMode()
Configured ssl verify mode.
|
public static SslOptions.Builder builder()
SslOptions.Builder to construct SslOptions.SslOptions.Builder to construct SslOptions.public static SslOptions defaults()
SslOptions with default settings: JVM truststore, TLS protocol and full
certificate and hostname verification (SslVerifyMode.FULL). Equivalent to
SslOptions.builder().build().SslOptions instance with default settings.public javax.net.ssl.SSLContext createSslContext()
throws java.io.IOException,
java.security.GeneralSecurityException
SSLContext object that is configured with values from this SslOptions object.SSLContextjava.io.IOException - thrown when loading the keystore or the truststore fails.java.security.GeneralSecurityException - thrown when loading the keystore or the truststore fails.public javax.net.ssl.SSLParameters getSslParameters()
createSslContext() must be called before this.SSLParameterspublic SslVerifyMode getSslVerifyMode()
SslVerifyModepublic static void assertFile(java.lang.String keyword,
java.io.File file)
file exists.keyword - file recognizerfile - java.lang.IllegalArgumentException - if the file doesn't existCopyright © 2026. All rights reserved.