public class StandardTlsConfiguration extends Object implements TlsConfiguration
SSLContexts.| Modifier and Type | Class and Description |
|---|---|
private static class |
StandardTlsConfiguration.StoreType |
| Modifier and Type | Field and Description |
|---|---|
private String |
keyPassword |
private String |
keystorePassword |
private String |
keystorePath |
private KeystoreType |
keystoreType |
private static String |
MASKED_PASSWORD_LOG |
private static String |
NULL_LOG |
private String |
protocol |
private static String |
TLS_PROTOCOL_VERSION |
private String |
truststorePassword |
private String |
truststorePath |
private KeystoreType |
truststoreType |
JAVA_11_MAX_SUPPORTED_TLS_PROTOCOL_VERSION, JAVA_11_SUPPORTED_TLS_PROTOCOL_VERSIONS, JAVA_8_MAX_SUPPORTED_TLS_PROTOCOL_VERSION, JAVA_8_SUPPORTED_TLS_PROTOCOL_VERSIONS, LEGACY_TLS_PROTOCOL_VERSIONS, SSL_PROTOCOL, TLS_1_0_PROTOCOL, TLS_1_1_PROTOCOL, TLS_1_2_PROTOCOL, TLS_PROTOCOL| Constructor and Description |
|---|
StandardTlsConfiguration()
Default constructor present for testing and completeness.
|
StandardTlsConfiguration(String keystorePath,
String keystorePassword,
KeystoreType keystoreType,
String truststorePath,
String truststorePassword,
KeystoreType truststoreType)
Instantiates a container object with the given configuration values.
|
StandardTlsConfiguration(String keystorePath,
String keystorePassword,
String keyPassword,
KeystoreType keystoreType,
String truststorePath,
String truststorePassword,
KeystoreType truststoreType)
Instantiates a container object with the given configuration values.
|
StandardTlsConfiguration(String keystorePath,
String keystorePassword,
String keyPassword,
KeystoreType keystoreType,
String truststorePath,
String truststorePassword,
KeystoreType truststoreType,
String protocol)
Instantiates a container object with the given configuration values.
|
StandardTlsConfiguration(String keystorePath,
String keystorePassword,
String keyPassword,
String keystoreType,
String truststorePath,
String truststorePassword,
String truststoreType)
Instantiates a container object with the given configuration values.
|
StandardTlsConfiguration(String keystorePath,
String keystorePassword,
String keyPassword,
String keystoreType,
String truststorePath,
String truststorePassword,
String truststoreType,
String protocol)
Instantiates a container object with the given configuration values.
|
StandardTlsConfiguration(TlsConfiguration other)
Instantiates a container object with a deep copy of the given configuration values.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
static TlsConfiguration |
fromNiFiProperties(NiFiProperties niFiProperties)
Returns a
TlsConfiguration instantiated from the relevant NiFi properties. |
static TlsConfiguration |
fromNiFiProperties(Properties niFiProperties)
Returns a
TlsConfiguration instantiated from the relevant NiFi properties. |
static StandardTlsConfiguration |
fromNiFiPropertiesTruststoreOnly(NiFiProperties niFiProperties)
Returns a
TlsConfiguration instantiated
from the relevant NiFiProperties properties for the truststore
only. |
String[] |
getEnabledProtocols()
Get Enabled TLS Protocols translates SSL to legacy protocols and TLS to current protocols or returns configured protocol
|
private URL |
getFileUrl(String path) |
String |
getFunctionalKeyPassword()
Returns the "working" key password -- if the key password is populated, it is returned; otherwise the
getKeystorePassword() is returned. |
String |
getFunctionalKeyPasswordForLogging()
Returns
"********" if the functional key password is populated, "null" if not. |
String |
getKeyPassword() |
String |
getKeyPasswordForLogging()
Returns
"********" if the key password is populated, "null" if not. |
String |
getKeystorePassword() |
String |
getKeystorePasswordForLogging()
Returns
"********" if the keystore password is populated, "null" if not. |
String |
getKeystorePath() |
String[] |
getKeystorePropertiesForLogging()
Returns a
String[] containing the keystore properties for logging. |
KeystoreType |
getKeystoreType() |
String |
getProtocol() |
String |
getTruststorePassword() |
String |
getTruststorePasswordForLogging()
Returns
"********" if the truststore password is populated, "null" if not. |
String |
getTruststorePath() |
String[] |
getTruststorePropertiesForLogging()
Returns a
String[] containing the truststore properties for logging. |
KeystoreType |
getTruststoreType() |
int |
hashCode() |
boolean |
isAnyKeystorePopulated()
Returns
true if any of the keystore properties is populated, indicating that the caller expects a valid keystore to be generated. |
private boolean |
isAnyPopulated(String path,
String password,
KeystoreType type) |
boolean |
isAnyTruststorePopulated()
Returns
true if any of the truststore properties is populated, indicating that the caller expects a valid truststore to be generated. |
boolean |
isKeystorePopulated()
Returns
true if the necessary properties are populated to instantiate a keystore. |
boolean |
isKeystoreValid()
Returns
true if the necessary properties are populated and the keystore can be successfully instantiated (i.e. |
private boolean |
isStorePopulated(String path,
String password,
KeystoreType type,
StandardTlsConfiguration.StoreType storeType) |
private boolean |
isStoreValid(String path,
String password,
KeystoreType type,
StandardTlsConfiguration.StoreType storeType) |
boolean |
isTruststorePopulated()
Returns
true if the necessary properties are populated to instantiate a truststore. |
boolean |
isTruststoreValid()
Returns
true if the necessary properties are populated and the truststore can be successfully instantiated (i.e. |
private static String |
maskPasswordForLog(String password) |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitgetCurrentSupportedTlsProtocolVersions, getHighestCurrentSupportedTlsProtocolVersion, getJavaVersion, isEmpty, parseJavaVersionprivate static final String TLS_PROTOCOL_VERSION
private static final String MASKED_PASSWORD_LOG
private static final String NULL_LOG
private final String keystorePath
private final String keystorePassword
private final String keyPassword
private final KeystoreType keystoreType
private final String truststorePath
private final String truststorePassword
private final KeystoreType truststoreType
private final String protocol
public StandardTlsConfiguration()
public StandardTlsConfiguration(String keystorePath, String keystorePassword, KeystoreType keystoreType, String truststorePath, String truststorePassword, KeystoreType truststoreType)
keystorePath - the keystore pathkeystorePassword - the keystore passwordkeystoreType - the keystore typetruststorePath - the truststore pathtruststorePassword - the truststore passwordtruststoreType - the truststore typepublic StandardTlsConfiguration(String keystorePath, String keystorePassword, String keyPassword, KeystoreType keystoreType, String truststorePath, String truststorePassword, KeystoreType truststoreType)
keystorePath - the keystore pathkeystorePassword - the keystore passwordkeyPassword - the key passwordkeystoreType - the keystore typetruststorePath - the truststore pathtruststorePassword - the truststore passwordtruststoreType - the truststore typepublic StandardTlsConfiguration(String keystorePath, String keystorePassword, String keyPassword, String keystoreType, String truststorePath, String truststorePassword, String truststoreType)
keystorePath - the keystore pathkeystorePassword - the keystore passwordkeyPassword - the key passwordkeystoreType - the keystore type as a StringtruststorePath - the truststore pathtruststorePassword - the truststore passwordtruststoreType - the truststore type as a Stringpublic StandardTlsConfiguration(String keystorePath, String keystorePassword, String keyPassword, String keystoreType, String truststorePath, String truststorePassword, String truststoreType, String protocol)
keystorePath - the keystore pathkeystorePassword - the keystore passwordkeyPassword - the (optional) key password -- if null, the keystore password is assumed the same for the individual keykeystoreType - the keystore type as a StringtruststorePath - the truststore pathtruststorePassword - the truststore passwordtruststoreType - the truststore type as a Stringprotocol - the TLS protocol version stringpublic StandardTlsConfiguration(String keystorePath, String keystorePassword, String keyPassword, KeystoreType keystoreType, String truststorePath, String truststorePassword, KeystoreType truststoreType, String protocol)
keystorePath - the keystore pathkeystorePassword - the keystore passwordkeyPassword - the (optional) key password -- if null, the keystore password is assumed the same for the individual keykeystoreType - the keystore typetruststorePath - the truststore pathtruststorePassword - the truststore passwordtruststoreType - the truststore typeprotocol - the TLS protocol version stringpublic StandardTlsConfiguration(TlsConfiguration other)
other - the configuration to copypublic static TlsConfiguration fromNiFiProperties(NiFiProperties niFiProperties)
TlsConfiguration instantiated from the relevant NiFi properties.niFiProperties - the NiFi propertiespublic static TlsConfiguration fromNiFiProperties(Properties niFiProperties)
TlsConfiguration instantiated from the relevant NiFi properties.niFiProperties - the NiFi properties, as a simple java.util.Properties objectpublic static StandardTlsConfiguration fromNiFiPropertiesTruststoreOnly(NiFiProperties niFiProperties)
TlsConfiguration instantiated
from the relevant NiFiProperties properties for the truststore
only. No keystore properties are read or used.niFiProperties - the NiFi propertiespublic String getKeystorePath()
getKeystorePath in interface TlsConfigurationpublic String getKeystorePassword()
getKeystorePassword in interface TlsConfigurationpublic String getKeystorePasswordForLogging()
"********" if the keystore password is populated, "null" if not.getKeystorePasswordForLogging in interface TlsConfigurationpublic String getKeyPassword()
getKeyPassword in interface TlsConfigurationpublic String getKeyPasswordForLogging()
"********" if the key password is populated, "null" if not.getKeyPasswordForLogging in interface TlsConfigurationpublic String getFunctionalKeyPassword()
getKeystorePassword() is returned.getFunctionalKeyPassword in interface TlsConfigurationpublic String getFunctionalKeyPasswordForLogging()
"********" if the functional key password is populated, "null" if not.getFunctionalKeyPasswordForLogging in interface TlsConfigurationpublic KeystoreType getKeystoreType()
getKeystoreType in interface TlsConfigurationpublic String getTruststorePath()
getTruststorePath in interface TlsConfigurationpublic String getTruststorePassword()
getTruststorePassword in interface TlsConfigurationpublic String getTruststorePasswordForLogging()
"********" if the truststore password is populated, "null" if not.getTruststorePasswordForLogging in interface TlsConfigurationpublic KeystoreType getTruststoreType()
getTruststoreType in interface TlsConfigurationpublic String getProtocol()
getProtocol in interface TlsConfigurationpublic boolean isKeystorePopulated()
true if the necessary properties are populated to instantiate a keystore. This does not validate the values (see isKeystoreValid()).isKeystorePopulated in interface TlsConfigurationpublic boolean isAnyKeystorePopulated()
true if any of the keystore properties is populated, indicating that the caller expects a valid keystore to be generated.isAnyKeystorePopulated in interface TlsConfigurationpublic boolean isKeystoreValid()
true if the necessary properties are populated and the keystore can be successfully instantiated (i.e. the path is valid and the password(s) are correct).isKeystoreValid in interface TlsConfigurationpublic boolean isTruststorePopulated()
true if the necessary properties are populated to instantiate a truststore. This does not validate the values (see isTruststoreValid()).isTruststorePopulated in interface TlsConfigurationpublic boolean isAnyTruststorePopulated()
true if any of the truststore properties is populated, indicating that the caller expects a valid truststore to be generated.isAnyTruststorePopulated in interface TlsConfigurationpublic boolean isTruststoreValid()
true if the necessary properties are populated and the truststore can be successfully instantiated (i.e. the path is valid and the password is correct).isTruststoreValid in interface TlsConfigurationpublic String[] getKeystorePropertiesForLogging()
String[] containing the keystore properties for logging. The order is
getKeystorePath(), getKeystorePasswordForLogging(),
getFunctionalKeyPasswordForLogging(), getKeystoreType() (using the type or "null").getKeystorePropertiesForLogging in interface TlsConfigurationpublic String[] getTruststorePropertiesForLogging()
String[] containing the truststore properties for logging. The order is
getTruststorePath(), getTruststorePasswordForLogging(),
getTruststoreType() (using the type or "null").getTruststorePropertiesForLogging in interface TlsConfigurationpublic String[] getEnabledProtocols()
getEnabledProtocols in interface TlsConfigurationprivate boolean isAnyPopulated(String path, String password, KeystoreType type)
private boolean isStorePopulated(String path, String password, KeystoreType type, StandardTlsConfiguration.StoreType storeType)
private boolean isStoreValid(String path, String password, KeystoreType type, StandardTlsConfiguration.StoreType storeType)
Copyright © 2022 Apache NiFi Project. All rights reserved.