Package com.helger.phase4.crypto
Class AS4CryptoFactoryInMemoryKeyStore
java.lang.Object
com.helger.phase4.crypto.AbstractAS4CryptoFactory
com.helger.phase4.crypto.AS4CryptoFactoryInMemoryKeyStore
- All Implemented Interfaces:
IAS4CryptoFactory
This class contains an implementation of
IAS4CryptoFactory in which
case the KeyStore is available in memory and the settings are NOT
read from a file. Created for https://github.com/phax/phase4/issues/28- Since:
- 0.9.7
- Author:
- Philip Helger
-
Constructor Summary
ConstructorsConstructorDescriptionAS4CryptoFactoryInMemoryKeyStore(KeyStore aKeyStore, String sKeyAlias, String sKeyPassword, KeyStore aTrustStore) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal org.apache.wss4j.common.crypto.CryptogetCrypto(ECryptoMode eCryptoMode) Lazily create aCryptoinstance using the key store and trust store from the constructor.final Stringfinal StringDeprecated.getKeyPasswordPerAlias(String sSearchKeyAlias) Returns the password for the key represented by the provided alias.final KeyStorefinal KeyStoreMethods inherited from class com.helger.phase4.crypto.AbstractAS4CryptoFactory
getCertificate, getPrivateKeyEntry
-
Constructor Details
-
AS4CryptoFactoryInMemoryKeyStore
public AS4CryptoFactoryInMemoryKeyStore(@Nonnull KeyStore aKeyStore, @Nonnull @Nonempty String sKeyAlias, @Nonnull String sKeyPassword, @Nullable KeyStore aTrustStore) Default constructor.- Parameters:
aKeyStore- The key store to be used. May not benull.sKeyAlias- The key alias to be used. May neither benullnor empty.sKeyPassword- The key password to be used. May not benullbut maybe empty.aTrustStore- The optional trust store to be used. If none is provided the default Java runtime truststore (cacerts) is used.
-
-
Method Details
-
getCrypto
@Nonnull public final org.apache.wss4j.common.crypto.Crypto getCrypto(@Nonnull ECryptoMode eCryptoMode) Lazily create aCryptoinstance using the key store and trust store from the constructor.- 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.
-