Package com.helger.phase4.crypto
Class AS4CryptoFactoryInMemoryKeyStore
java.lang.Object
com.helger.phase4.crypto.AS4CryptoFactoryInMemoryKeyStore
- All Implemented Interfaces:
IAS4CryptoFactory
@Immutable
public class AS4CryptoFactoryInMemoryKeyStore
extends Object
implements 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
-
Field Summary
Fields inherited from interface com.helger.phase4.crypto.IAS4CryptoFactory
DEFAULT_ALLOW_RSA15_KEY_TRANSPORT_ALGORITHM -
Constructor Summary
ConstructorsConstructorDescriptionAS4CryptoFactoryInMemoryKeyStore(KeyStore aKeyStore, String sKeyAlias, String sKeyPassword, KeyStore aTrustStore) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal org.apache.wss4j.common.crypto.CryptoLazily create aCryptoinstance using the key store and trust store from the constructor.final Stringfinal Stringfinal KeyStorefinal KeyStore.PrivateKeyEntryfinal KeyStoreMethods 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, isAllowRSA15KeyTransportAlgorithm
-
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
Lazily create aCryptoinstance using the key store and trust store from the constructor.- 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.
-
getTrustStore
- Specified by:
getTrustStorein interfaceIAS4CryptoFactory- Returns:
- The trust store to be used or
nullif none is configured.
-