Class SslStoreParams

java.lang.Object
com.illumon.util.SslStoreParams

public class SslStoreParams extends Object
Helper class to allow the retrieval of SSL-related parameters. SslDefaultStore always uses the same properties to retrieve this information. Instead, this class allows the properties to be specified, either with a property prefix, or individually. It uses Configuration to retrieve these property values.
  • Method Details

    • getKeyStorePath

      public static String getKeyStorePath(@NotNull com.fishlib.configuration.Configuration configuration, @Nullable String propertyName)
      Retrieve the key store path using the supplied property name.
      Parameters:
      configuration - the Configuration instance to use
      propertyName - the property name. If no value is supplied, then the property DEFAULT_KEYSTORE_PATH_PROPERTY_NAME is used.
      Returns:
      the key store path
    • getKeyStorePathFromPrefix

      public static String getKeyStorePathFromPrefix(@NotNull com.fishlib.configuration.Configuration configuration, @NotNull String prefix)
      Retrieve the key store path based on the supplied property name prefix. A dot and DEFAULT_KEYSTORE_PATH_PROPERTY_NAME will be appended to the prefix to look up the property.
      Parameters:
      configuration - the Configuration instance to use
      prefix - the property name prefix to which DEFAULT_KEYSTORE_PATH_PROPERTY_NAME will be added
      Returns:
      the key store path
    • getPassphrase

      public static String getPassphrase(@NotNull com.fishlib.configuration.Configuration configuration, @Nullable String environmentVariable, @Nullable String filePropertyName, @Nullable String propertyName)
      Calls getPassphrase(Configuration, String, String, String, boolean). The last boolean parameter denotes whether the passphrase is base64 encoded, and is obtained by checking the value of the configuration property DEFAULT_PASSPHRASE_BASE64_PROPERTY_NAME, defaulting to true.
      Parameters:
      configuration - the Configuration instance to use
      environmentVariable - the name of an environment variable which contains the passphrase. If no value is supplied, the environment variable DEFAULT_PASSPHRASE_ENVIRONMENT_VARIABLE will be used.
      filePropertyName - the property name to retrieve the name of a file containing the passphrase. If no value is supplied, then the property DEFAULT_PASSPHRASE_FILE_PROPERTY_NAME will be used.
      propertyName - the property name to retrieve the passphrase. If no value is supplied, then the property DEFAULT_PASSPHRASE_PROPERTY_NAME is used.
      Returns:
      the passphrase
    • getPassphrase

      public static String getPassphrase(@NotNull com.fishlib.configuration.Configuration configuration, @Nullable String environmentVariable, @Nullable String filePropertyName, @Nullable String propertyName, boolean base64Encoded)
      Retrieve the passphrase based on the supplied property names, using PropertyRetriever.getProperty(Configuration, String, String, String, String, boolean). The order of attempted retrieval is environment variable, file, property.
      Parameters:
      configuration - the Configuration instance to use
      environmentVariable - the name of an environment variable which contains the passphrase. If no value is supplied, the environment variable DEFAULT_PASSPHRASE_ENVIRONMENT_VARIABLE will be used.
      filePropertyName - the property name to retrieve the name of a file containing the passphrase. If no value is supplied, then the property DEFAULT_PASSPHRASE_FILE_PROPERTY_NAME will be used.
      propertyName - the property name to retrieve the passphrase. If no value is supplied, then the property DEFAULT_PASSPHRASE_PROPERTY_NAME is used.
      base64Encoded - if true, the passphrase will be base64 decoded and returned
      Returns:
      the passphrase
    • getPassphraseFromPrefix

      public static String getPassphraseFromPrefix(@NotNull com.fishlib.configuration.Configuration configuration, @NotNull String prefix)
      Calls getPassphraseFromPrefix(Configuration, String, boolean) with true as the last parameter in order to retrieve a base64 encoded passphrase.
      Parameters:
      configuration - the Configuration instance to use
      prefix - the property name prefix
      Returns:
      the passphrase
      See Also:
    • getPassphraseFromPrefix

      public static String getPassphraseFromPrefix(@NotNull com.fishlib.configuration.Configuration configuration, @NotNull String prefix, boolean base64Encoded)
      Retrieve the passphrase based on the supplied property name prefix. The environment variable name will be generated by concatenating the prefix, an underscore, and the value of DEFAULT_PASSPHRASE_ENVIRONMENT_VARIABLE, and converting that to uppercase. The file property will be generated by appending a dot and the value of DEFAULT_PASSPHRASE_FILE_PROPERTY_NAME to the prefix. The passphrase property will be generated by appending a dot and value of DEFAULT_PASSPHRASE_PROPERTY_NAME to the prefix. Then PropertyRetriever.getProperty(Configuration, String, String, String, String, boolean) will be called to retrieve the value. The order of attempted retrieval is environment variable, file, property. If base64Encoded is true, then the passphrase is assumed to be base64 encoded and the decoded value will be returned.
      Parameters:
      configuration - the Configuration instance to use
      prefix - the property name prefix
      base64Encoded - if true, the passphrase will be base64 decoded and returned
      Returns:
      the passphrase