Package io.deephaven.util
Class SSLUtils
java.lang.Object
io.deephaven.util.SSLUtils
Class to help with
SSLContext creation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SSLContextcreateSSLContext(com.fishlib.configuration.Configuration configuration, String propertyPrefix, boolean createKeyManagerFactory, String keyManagerFactoryAlgorithm) Create anSSLContextfrom the standard Deephaven properties, using the specified property prefix.static StringgetKeystorePassphrase(com.fishlib.configuration.Configuration configuration, String propertyMeaning, String environmentVariable, String propertyPrefix) Retrieve the keystore passphrase for a pemfile.
-
Constructor Details
-
SSLUtils
public SSLUtils()
-
-
Method Details
-
createSSLContext
@NotNull public static SSLContext createSSLContext(@NotNull com.fishlib.configuration.Configuration configuration, @NotNull String propertyPrefix, boolean createKeyManagerFactory, @Nullable String keyManagerFactoryAlgorithm) throws DeephavenException Create anSSLContextfrom the standard Deephaven properties, using the specified property prefix. This will useSslStoreParams.getKeyStorePathFromPrefix(com.fishlib.configuration.Configuration, java.lang.String)andSslStoreParams.getPassphraseFromPrefix(com.fishlib.configuration.Configuration, java.lang.String)to retrieve a keystore path and passphrase from the Deephaven configuration and get theKeyStore, then initialize an optionalKeyManagerFactorywith it, and finally get and initialize theSSLContext. This context is suitable for use in servers such as Prometheus.- Parameters:
configuration- aConfigurationpropertyPrefix- the prefix to be used to look for keystore propertiescreateKeyManagerFactory- if true, create theKeyManagerFactorykeyManagerFactoryAlgorithm- if provided, the algorithm used to create theKeyManagerFactory, otherwise SunX509 will be used- Returns:
- the
SSLContext - Throws:
DeephavenException- wrapping other SSL-related exceptions
-
getKeystorePassphrase
public static String getKeystorePassphrase(@NotNull com.fishlib.configuration.Configuration configuration, @NotNull String propertyMeaning, @Nullable String environmentVariable, @Nullable String propertyPrefix) Retrieve the keystore passphrase for a pemfile. Either environmentVariable or propertyPrefix must be provided, or both.- Parameters:
configuration- aConfigurationpropertyMeaning- the property's meaning (for logging)environmentVariable- an optional environment variable to use to retrieve the passphrasepropertyPrefix- an optional property prefix to be used to retrieve the passphrase (an additional lookup will be performed with ".file" appended)- Returns:
- the keystore's passphrase, base-64-decoded if necessary
-