Class AS4CryptoFactoryConfiguration

All Implemented Interfaces:
IAS4CryptoFactory

@Immutable public class AS4CryptoFactoryConfiguration extends AS4CryptoFactoryInMemoryKeyStore
phase4 crypto factory settings based on IConfig. The configuration elements are solely taken from the global configuration and not from arbitrary files. Multiple different crypto factory configurations can be handled uses different configuration property prefixes. This class only supports Merlin as the crypto implementation.
Since:
3.0.0
Author:
Philip Helger
  • Constructor Details

    • AS4CryptoFactoryConfiguration

      public AS4CryptoFactoryConfiguration(@NonNull com.helger.config.fallback.IConfigWithFallback aConfig) throws Phase4RuntimeException
      This constructor takes the configuration object and uses the default prefix for backwards compatibility. This is kind of the default constructor.
      Parameters:
      aConfig - The configuration object to be used. May not be null.
      Throws:
      Phase4RuntimeException - If loading the key store configuration from configuration fails.
    • AS4CryptoFactoryConfiguration

      public AS4CryptoFactoryConfiguration(@NonNull com.helger.config.fallback.IConfigWithFallback aConfig, @Nonempty @NonNull @Nonempty String sConfigPrefix) throws Phase4RuntimeException
      This constructor takes the configuration object and uses the provided configuration prefix. This is kind of the default constructor.
      Parameters:
      aConfig - The configuration object to be used. May not be null.
      sConfigPrefix - The configuration prefix to be used. May neither be null nor empty and must end with a dot ('.').
      Throws:
      Phase4RuntimeException - If loading the key store configuration from configuration fails.
    • AS4CryptoFactoryConfiguration

      public AS4CryptoFactoryConfiguration(@NonNull com.helger.config.fallback.IConfigWithFallback aConfig, @Nonempty @NonNull @Nonempty String sConfigPrefix, boolean bLogError) throws Phase4RuntimeException
      This constructor takes the configuration object and uses the provided configuration prefix. This is kind of the default constructor.
      Parameters:
      aConfig - The configuration object to be used. May not be null.
      sConfigPrefix - The configuration prefix to be used. May neither be null nor empty and must end with a dot ('.').
      bLogError - true if errors should be logged if loading fails.
      Throws:
      Phase4RuntimeException - If loading the key store configuration from configuration fails.
  • Method Details

    • getDefaultInstance

      public static @NonNull AS4CryptoFactoryConfiguration getDefaultInstance() throws Phase4RuntimeException
      Returns:
      The default instance, created by reading the default properties from the configuration sources (application.properties, environment variables and Java system properties).
      Throws:
      Phase4RuntimeException - if one of the mandatory configuration parameters is not present.
    • getDefaultInstanceOrNull

      public static @Nullable AS4CryptoFactoryConfiguration getDefaultInstanceOrNull()
      Same as getDefaultInstance() just that it returns null instead of throwing a RuntimeException.
      Returns:
      null in case of error.
    • getKeyStoreDescriptor

      public @NonNull com.helger.security.keystore.IKeyStoreAndKeyDescriptor getKeyStoreDescriptor()
      Returns:
      The descriptor used to load the key store. Never null.
    • getTrustStoreDescriptor

      public @NonNull com.helger.security.keystore.ITrustStoreDescriptor getTrustStoreDescriptor()
      Returns:
      The descriptor used to load the trust store. Never null.