Package com.helger.phase4.crypto
Class AS4CryptoFactoryInMemoryKeyStore
java.lang.Object
com.helger.phase4.crypto.AbstractAS4CryptoFactory
com.helger.phase4.crypto.AS4CryptoFactoryInMemoryKeyStore
- All Implemented Interfaces:
IAS4CryptoFactory
- Direct Known Subclasses:
AS4CryptoFactoryConfiguration
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(@NonNull com.helger.security.keystore.IKeyStoreAndKeyDescriptor aKeyStoreDesc, @Nullable com.helger.security.keystore.ITrustStoreDescriptor aTrustStoreDesc) Constructor using the key store and trust store descriptors.AS4CryptoFactoryInMemoryKeyStore(@NonNull KeyStore aKeyStore, @NonNull @Nonempty String sKeyAlias, char @NonNull [] aKeyPassword, @Nullable KeyStore aTrustStore) Default constructor. -
Method Summary
Modifier and TypeMethodDescription@NonNull org.apache.wss4j.common.crypto.CryptogetCrypto(@NonNull ECryptoMode eCryptoMode) Lazily create aCryptoinstance using the key store and trust store from the constructor.final @NonNull Stringchar @Nullable []getKeyPasswordPerAliasCharArray(@Nullable String sSearchKeyAlias) Returns the password for the key represented by the provided alias.final @NonNull KeyStorefinal @Nullable KeyStoretoString()Methods 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
-
AS4CryptoFactoryInMemoryKeyStore
public AS4CryptoFactoryInMemoryKeyStore(@NonNull com.helger.security.keystore.IKeyStoreAndKeyDescriptor aKeyStoreDesc, @Nullable com.helger.security.keystore.ITrustStoreDescriptor aTrustStoreDesc) Constructor using the key store and trust store descriptors.- Parameters:
aKeyStoreDesc- The key store descriptor. May not benull.aTrustStoreDesc- The trust store descriptor. May benullin which case the global JRE CA certs list will be used.- Since:
- 3.0.0
-
AS4CryptoFactoryInMemoryKeyStore
public AS4CryptoFactoryInMemoryKeyStore(@NonNull KeyStore aKeyStore, @Nonempty @NonNull @Nonempty String sKeyAlias, char @NonNull [] aKeyPassword, @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.aKeyPassword- 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. Removed "final" in v3 to allow users to use a differentCryptoimplementation if needed.- 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.
-
getKeyPasswordPerAliasCharArray
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.
-
toString
-