Class AS4CryptoFactoryInMemoryKeyStore

java.lang.Object
com.helger.phase4.crypto.AbstractAS4CryptoFactory
com.helger.phase4.crypto.AS4CryptoFactoryInMemoryKeyStore
All Implemented Interfaces:
IAS4CryptoFactory

@Immutable public class AS4CryptoFactoryInMemoryKeyStore extends AbstractAS4CryptoFactory
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 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 be null.
      sKeyAlias - The key alias to be used. May neither be null nor empty.
      sKeyPassword - The key password to be used. May not be null but 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 a Crypto instance using the key store and trust store from the constructor.
      Parameters:
      eCryptoMode - The crypto mode to use. Never null.
      Returns:
      A WSS4J Crypto instance and never null.
    • getKeyStore

      @Nonnull public final KeyStore getKeyStore()
      Returns:
      The underlying key store, or null if none is available (the reasons depend on the used implementation).
    • getKeyAlias

      @Nonnull public final String getKeyAlias()
      Returns:
      The keystore alias to resolve the private key entry. May be null.
    • getKeyPassword

      @Nonnull @Deprecated public final String getKeyPassword()
      Deprecated.
      Returns:
      The password to access the private key entry denoted by the key alias. May be null.
    • getKeyPasswordPerAlias

      @Nullable public String getKeyPasswordPerAlias(@Nullable String sSearchKeyAlias)
      Description copied from interface: IAS4CryptoFactory
      Returns 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 null if the factory doesn't have a password for the key.
    • getTrustStore

      @Nullable public final KeyStore getTrustStore()
      Returns:
      The trust store to be used or null if none is configured.