Class AbstractKeyStoreTokenConnection

java.lang.Object
eu.europa.esig.dss.token.AbstractSignatureTokenConnection
eu.europa.esig.dss.token.AbstractKeyStoreTokenConnection
All Implemented Interfaces:
SignatureTokenConnection, AutoCloseable
Direct Known Subclasses:
AppleSignatureToken, KeyStoreSignatureTokenConnection, MSCAPISignatureToken, Pkcs11SignatureToken

public abstract class AbstractKeyStoreTokenConnection extends AbstractSignatureTokenConnection
The keyStore token connection
  • Constructor Details

    • AbstractKeyStoreTokenConnection

      protected AbstractKeyStoreTokenConnection()
      Default constructor
  • Method Details

    • setKeyEntryPredicate

      public void setKeyEntryPredicate(Predicate<DSSPrivateKeyEntry> keyEntryPredicate)
      Sets a predicate to filter keys to be returned by #getKeys() method. Default : eu.europa.esig.dss.token.predicate.AllPrivateKeyPredicate - returns all keys extracted from the token connection
      Parameters:
      keyEntryPredicate - Predicate of DSSPrivateKeyEntry, e.g. DSSKeyEntryPredicate
    • getKeyStore

      protected abstract KeyStore getKeyStore() throws DSSException
      Gets the key store
      Returns:
      KeyStore
      Throws:
      DSSException
    • getKeyProtectionParameter

      protected abstract KeyStore.PasswordProtection getKeyProtectionParameter()
      Gets the password protection
      Returns:
      KeyStore.PasswordProtection
    • getKeys

      public List<DSSPrivateKeyEntry> getKeys() throws DSSException
      Description copied from interface: SignatureTokenConnection
      Retrieves all the available keys (private keys entries) from the token.
      Returns:
      List of encapsulated private keys
      Throws:
      DSSException - If there is any problem during the retrieval process
    • getKey

      public DSSPrivateKeyEntry getKey(String alias)
      This method allows to retrieve a DSSPrivateKeyEntry by alias
      Parameters:
      alias - the expected entry alias
      Returns:
      the private key or null if the alias does not exist
    • getKey

      public DSSPrivateKeyEntry getKey(String alias, KeyStore.PasswordProtection passwordProtection)
      This method allows to retrieve a DSSPrivateKeyEntry by alias
      Parameters:
      alias - the expected entry alias
      passwordProtection - key password
      Returns:
      the private key or null if the alias does not exist