Class AS4CryptoFactoryConfiguration

All Implemented Interfaces:
IAS4CryptoFactory

@Immutable public class AS4CryptoFactoryConfiguration extends AS4CryptoFactoryInMemoryKeyStore
phase4 crypto factory settings based on IConfig. It can do the same as AS4CryptoFactoryProperties except that 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.
Note: the default instance of this class should be a replacement for the default instance of AS4CryptoFactoryProperties, except that the support for the specific properties files private-crypto.properties and crypto.properties was removed.
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, @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, @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

      @Nonnull public static 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

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

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

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