Interface KeyStore

All Known Implementing Classes:
InMemoryKeyStore

public interface KeyStore
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addKey(com.sshtools.common.ssh.components.SshKeyPair pair, String description, KeyConstraints cs)
     
    boolean
    addKey(com.sshtools.common.ssh.components.SshPrivateKey prvkey, com.sshtools.common.ssh.components.SshPublicKey pubkey, String description, KeyConstraints cs)
    Add a key to this keystore
    boolean
    Delete all the keys in this keystore.
    boolean
    deleteKey(com.sshtools.common.ssh.components.SshPublicKey pubkey)
    Delete a key from the keystore.
    getKeyConstraints(com.sshtools.common.ssh.components.SshPublicKey key)
    Get the constraints for a key stored in this keystore.
    Map<com.sshtools.common.ssh.components.SshPublicKey,String>
    Return a Map of all the installed keys.
    boolean
    Determine if the store is currently locked.
    boolean
    lock(String password)
    Lock the keystore.
    byte[]
    performHashAndSign(com.sshtools.common.ssh.components.SshPublicKey pubkey, List<ForwardingNotice> forwardingNodes, byte[] data, int flags)
    Hash and sign some data using a key stored in this keystore.
    int
    How many keys are in this store?
    boolean
    unlock(String password)
    Unlock the keystore.
  • Method Details

    • getPublicKeys

      Map<com.sshtools.common.ssh.components.SshPublicKey,String> getPublicKeys()
      Return a Map of all the installed keys.
      Returns:
    • getKeyConstraints

      KeyConstraints getKeyConstraints(com.sshtools.common.ssh.components.SshPublicKey key)
      Get the constraints for a key stored in this keystore.
      Parameters:
      key - The public key.
      Returns:
    • size

      int size()
      How many keys are in this store?
      Returns:
      The number of keys in this store.
    • addKey

      boolean addKey(com.sshtools.common.ssh.components.SshPrivateKey prvkey, com.sshtools.common.ssh.components.SshPublicKey pubkey, String description, KeyConstraints cs) throws IOException
      Add a key to this keystore
      Parameters:
      prvkey - The private key
      pubkey - The public key
      description - A description for this key pair.
      cs - Any constraints.
      Returns:
      true if the key was added to the keystore.
      Throws:
      IOException
    • addKey

      boolean addKey(com.sshtools.common.ssh.components.SshKeyPair pair, String description, KeyConstraints cs) throws IOException
      Throws:
      IOException
    • deleteAllKeys

      boolean deleteAllKeys()
      Delete all the keys in this keystore.
    • performHashAndSign

      byte[] performHashAndSign(com.sshtools.common.ssh.components.SshPublicKey pubkey, List<ForwardingNotice> forwardingNodes, byte[] data, int flags) throws KeyTimeoutException, com.sshtools.common.ssh.SshException
      Hash and sign some data using a key stored in this keystore.
      Parameters:
      pubkey - The public key for which the signing should be untaken.
      forwardingNodes - A list of forwarding notices for this operation.
      data - The data to sign.
      Returns:
      Throws:
      KeyTimeoutException
      InvalidSshKeyException
      InvalidSshKeySignatureException
      com.sshtools.common.ssh.SshException
    • deleteKey

      boolean deleteKey(com.sshtools.common.ssh.components.SshPublicKey pubkey) throws IOException
      Delete a key from the keystore.
      Parameters:
      pubkey - The public key to delete.
      Returns:
      true if the key was deleted.
      Throws:
      IOException
    • lock

      boolean lock(String password) throws IOException
      Lock the keystore.
      Parameters:
      password - A password to secure the store. Only the same password will unlock the store.
      Returns:
      true if the store was locked.
      Throws:
      IOException
    • unlock

      boolean unlock(String password) throws IOException
      Unlock the keystore.
      Parameters:
      password - The password that was provided when locking the store.
      Returns:
      true if the store was unlocked.
      Throws:
      IOException
    • isLocked

      boolean isLocked()
      Determine if the store is currently locked.
      Returns: