Package io.github.stevenjdh.simple.ssl
Interface SimpleSSLContext.Builder
- All Known Implementing Classes:
SSLContextBuilderImpl
- Enclosing interface:
- SimpleSSLContext
public static interface SimpleSSLContext.Builder
A builder of SSLContext instances.
Builders are created by invoking newBuilder. Each of the setter methods modifies the state of the builder
and returns the same instance. Builders are not thread-safe and should
not be used concurrently from multiple threads without external
synchronization.
- Since:
- 1.0
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Returns a newSSLContextinstance built from the current state of this builder.Optionally sets the keystore type with PKCS12 being the default.Optionally sets the truststore type with PKCS12 being the default.withKeyStore(Path keyMaterialPath, char[] password) Optionally sets the keystore configuration to be used when building anSSLContext.withTrustStore(Path trustMaterialPath, char[] password) Optionally sets the truststore configuration to be used when building anSSLContext.
-
Method Details
-
withKeyStore
Optionally sets the keystore configuration to be used when building anSSLContext.- Parameters:
keyMaterialPath- The path to the keystore file containing key material.password- The password used to unlock the keystore. If this is set to null or an empty char[], it will be assumed that a password is not needed.- Returns:
- This builder.
-
withTrustStore
Optionally sets the truststore configuration to be used when building anSSLContext.- Parameters:
trustMaterialPath- The path to the truststore file containing trust material.password- The password used to unlock the truststore. If this is set to null or an empty char[], it will be assumed that a password is not needed.- Returns:
- This builder.
-
keyStoreType
Optionally sets the keystore type with PKCS12 being the default.- Parameters:
type- The keystore type such as PKCS12 or the legacy JKS.- Returns:
- This builder.
-
trustStoreType
Optionally sets the truststore type with PKCS12 being the default.- Parameters:
type- The truststore type such as PKCS12 or the legacy JKS.- Returns:
- This builder.
-
build
SSLContext build()Returns a newSSLContextinstance built from the current state of this builder.- Returns:
- A new
SSLContext.
-