Class TlsOptions
java.lang.Object
codes.grow.packages.betterstack.core.TlsOptions
TLS settings: custom CA, client certificate (mutual TLS) and the test-only
insecureSkipVerify. PEM files are read once when the client is created. Private keys must be
unencrypted PKCS#8 (BEGIN PRIVATE KEY); RSA, EC and EdDSA keys are supported.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic TlsOptions.Builderbuilder()Starts a builder.Returns the CA bundle path.Returns the inline CA bundle.Returns the client certificate path.Returns the client key path.static TlsOptionsdefaults()Returns options without any customisation (system trust store).booleanReturns whether certificate and host name verification is disabled (tests only).booleanisCustom()Returns whether any option differs from the system defaults.Builds the SSL context for these options.Returns a builder initialised from these options.toString()voidvalidate()Checks that certificate and key come together.
-
Method Details
-
defaults
Returns options without any customisation (system trust store).- Returns:
- default options
-
builder
Starts a builder.- Returns:
- a new builder
-
toBuilder
Returns a builder initialised from these options.- Returns:
- a new builder
-
caCertPath
Returns the CA bundle path.- Returns:
- the path, or empty
-
caCertPem
Returns the inline CA bundle.- Returns:
- PEM text, or empty
-
clientCertPath
Returns the client certificate path.- Returns:
- the path, or empty
-
clientKeyPath
Returns the client key path.- Returns:
- the path, or empty
-
insecureSkipVerify
public boolean insecureSkipVerify()Returns whether certificate and host name verification is disabled (tests only).- Returns:
- true when verification is off
-
isCustom
public boolean isCustom()Returns whether any option differs from the system defaults.- Returns:
- true when a custom SSL context is needed
-
validate
public void validate()Checks that certificate and key come together.- Throws:
ConfigException- when only one of them is set
-
sslContext
Builds the SSL context for these options.- Returns:
- a new SSL context
- Throws:
ConfigException- when a file cannot be read or parsed (the message names the setting, never the content)
-
toString
-