Package com.helger.phase4.crypto
Class AS4CryptoFactoryProperties
java.lang.Object
com.helger.phase4.crypto.AS4CryptoFactoryProperties
- All Implemented Interfaces:
IAS4CryptoFactory
phase4 crypto factory settings based on
AS4CryptoProperties- Since:
- 0.11.0
- Author:
- Philip Helger+
-
Field Summary
Fields inherited from interface com.helger.phase4.crypto.IAS4CryptoFactory
DEFAULT_ALLOW_RSA15_KEY_TRANSPORT_ALGORITHM -
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 X509Certificatefinal org.apache.wss4j.common.crypto.CryptoLazily create aCryptoinstance using the properties fromcryptoProperties().static AS4CryptoFactoryPropertiesfinal Stringfinal Stringfinal KeyStorefinal KeyStore.PrivateKeyEntryfinal KeyStorebooleanstatic AS4CryptoPropertiesreadCryptoPropertiesFromFile(String sCryptoPropertiesPath) Read crypto properties from the specified file path.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.helger.phase4.crypto.IAS4CryptoFactory
getKeyPasswordPerAlias
-
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
Lazily create aCryptoinstance using the properties fromcryptoProperties().- Specified by:
getCryptoin interfaceIAS4CryptoFactory- Returns:
- A
Cryptoinstance and nevernull.
-
getKeyStore
- Specified by:
getKeyStorein interfaceIAS4CryptoFactory- Returns:
- The underlying key store, or
nullif none is available (the reasons depend on the used implementation).
-
getPrivateKeyEntry
- Specified by:
getPrivateKeyEntryin interfaceIAS4CryptoFactory- Returns:
- The underlying private key entry from the keystore or
nullif none is available (the reasons depend on the used implementation).
-
getKeyAlias
- Specified by:
getKeyAliasin interfaceIAS4CryptoFactory- Returns:
- The keystore alias to resolve the private key entry. May be
null.
-
getKeyPassword
- Specified by:
getKeyPasswordin interfaceIAS4CryptoFactory- Returns:
- The password to access the private key entry denoted by the key
alias. May be
null.
-
getCertificate
- Returns:
- The public certificate of the private key entry or
nullif the private key entry could not be loaded. - See Also:
-
getTrustStore
- Specified by:
getTrustStorein interfaceIAS4CryptoFactory- Returns:
- The trust store to be used or
nullif none is configured.
-
isAllowRSA15KeyTransportAlgorithm
public boolean isAllowRSA15KeyTransportAlgorithm()- Specified by:
isAllowRSA15KeyTransportAlgorithmin interfaceIAS4CryptoFactory- Returns:
- Whether to allow the RSA v1.5 Key Transport Algorithm or not.
Default is
false.
-
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.
-