Package com.helger.phase4.crypto
Class AS4CryptoFactoryConfiguration
java.lang.Object
com.helger.phase4.crypto.AbstractAS4CryptoFactory
com.helger.phase4.crypto.AS4CryptoFactoryInMemoryKeyStore
com.helger.phase4.crypto.AS4CryptoFactoryConfiguration
- All Implemented Interfaces:
IAS4CryptoFactory
phase4 crypto factory settings based on
Note: the default instance of this class should be a replacement for the default instance of
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 Summary
ConstructorsConstructorDescriptionAS4CryptoFactoryConfiguration(com.helger.config.fallback.IConfigWithFallback aConfig) This constructor takes the configuration object and uses the default prefix for backwards compatibility.AS4CryptoFactoryConfiguration(com.helger.config.fallback.IConfigWithFallback aConfig, String sConfigPrefix) This constructor takes the configuration object and uses the provided configuration prefix.AS4CryptoFactoryConfiguration(com.helger.config.fallback.IConfigWithFallback aConfig, String sConfigPrefix, boolean bLogError) This constructor takes the configuration object and uses the provided configuration prefix. -
Method Summary
Modifier and TypeMethodDescriptionSame asgetDefaultInstance()just that it returnsnullinstead of throwing a RuntimeException.com.helger.security.keystore.IKeyStoreAndKeyDescriptorcom.helger.security.keystore.ITrustStoreDescriptorMethods inherited from class com.helger.phase4.crypto.AS4CryptoFactoryInMemoryKeyStore
getCrypto, getKeyAlias, getKeyPasswordPerAliasCharArray, getKeyStore, getTrustStore, toStringMethods inherited from class com.helger.phase4.crypto.AbstractAS4CryptoFactory
getCertificate, getPrivateKeyEntryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.phase4.crypto.IAS4CryptoFactory
getKeyPasswordPerAlias
-
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 benull.- 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 benull.sConfigPrefix- The configuration prefix to be used. May neither benullnor 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 benull.sConfigPrefix- The configuration prefix to be used. May neither benullnor empty and must end with a dot ('.').bLogError-trueif 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
Same asgetDefaultInstance()just that it returnsnullinstead of throwing a RuntimeException.- Returns:
nullin case of error.
-
getKeyStoreDescriptor
- Returns:
- The descriptor used to load the key store. Never
null.
-
getTrustStoreDescriptor
- Returns:
- The descriptor used to load the trust store. Never
null.
-