Package com.helger.phase4.crypto
Class AS4CryptoFactoryProperties
java.lang.Object
com.helger.phase4.crypto.AbstractAS4CryptoFactory
com.helger.phase4.crypto.AS4CryptoFactoryProperties
- All Implemented Interfaces:
IAS4CryptoFactory
phase4 crypto factory settings based on
AS4CryptoProperties- Since:
- 0.11.0
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionAS4CryptoFactoryProperties(AS4CryptoProperties aCryptoProps) This constructor takes the crypto properties directly. -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.wss4j.common.crypto.CryptocreateCrypto(AS4CryptoProperties aCryptoProps) Helper method to create a WSS4JCryptoinstance based on the provided crypto properties.final AS4CryptoPropertiesfinal org.apache.wss4j.common.crypto.CryptogetCrypto(ECryptoMode eCryptoMode) Lazily create aCryptoinstance using the properties fromcryptoProperties().static AS4CryptoFactoryPropertiesfinal Stringfinal StringDeprecated.getKeyPasswordPerAlias(String sSearchKeyAlias) Returns the password for the key represented by the provided alias.final KeyStorefinal KeyStorestatic AS4CryptoPropertiesreadCryptoPropertiesFromFile(String sCryptoPropertiesPath) Read crypto properties from the specified file path.Methods inherited from class com.helger.phase4.crypto.AbstractAS4CryptoFactory
getCertificate, getPrivateKeyEntry
-
Constructor Details
-
AS4CryptoFactoryProperties
This constructor takes the crypto properties directly. See theAbstractAS4Clientfor a usage example.- Parameters:
aCryptoProps- The properties to be used. May not benull. Note: the object is cloned internally to avoid outside modification.
-
-
Method Details
-
getDefaultInstance
- Returns:
- The default instance, created by reading the properties from the configuration sources.
- Since:
- 0.11.0
-
cryptoProperties
- Returns:
- The crypto properties as created in the constructor. Never
null.
-
createCrypto
@Nonnull public static org.apache.wss4j.common.crypto.Crypto createCrypto(@Nonnull AS4CryptoProperties aCryptoProps) Helper method to create a WSS4JCryptoinstance based on the provided crypto properties.- Parameters:
aCryptoProps- The crypto properties to use. May not benull.- Returns:
- A new
Cryptoobject. - Throws:
IllegalStateException- if creation failed
-
getCrypto
@Nonnull public final org.apache.wss4j.common.crypto.Crypto getCrypto(@Nonnull ECryptoMode eCryptoMode) Lazily create aCryptoinstance using the properties fromcryptoProperties().- Parameters:
eCryptoMode- The crypto mode to use. Nevernull.- Returns:
- A WSS4J
Cryptoinstance and nevernull.
-
getKeyStore
- Returns:
- The underlying key store, or
nullif none is available (the reasons depend on the used implementation).
-
getKeyAlias
- Returns:
- The keystore alias to resolve the private key entry. May be
null.
-
getKeyPassword
Deprecated.- Returns:
- The password to access the private key entry denoted by the key
alias. May be
null.
-
getKeyPasswordPerAlias
Description copied from interface:IAS4CryptoFactoryReturns the password for the key represented by the provided alias.- Parameters:
sSearchKeyAlias- The alias of the key whose password is to be retrieved.- Returns:
- The password for the key represented by the provided by the alias
or
nullif the factory doesn't have a password for the key.
-
getTrustStore
- Returns:
- The trust store to be used or
nullif none is configured.
-
readCryptoPropertiesFromFile
@Nonnull public static AS4CryptoProperties readCryptoPropertiesFromFile(@Nullable String sCryptoPropertiesPath) Read crypto properties from the specified file path.- Parameters:
sCryptoPropertiesPath- The class path to read the properties file from. It isnullor empty, than the default file "crypto.properties" is read.- Returns:
- Never
null.
-