Interface SshAgent

All Superinterfaces:
AutoCloseable, Channel, Closeable
All Known Implementing Classes:
AbstractAgentProxy, AgentClient, AgentDelegate, AgentImpl

public interface SshAgent extends Channel
SSH key agent server
  • Field Details

  • Method Details

    • getIdentities

      Iterable<? extends Map.Entry<PublicKey,String>> getIdentities() throws IOException
      Throws:
      IOException
    • sign

      Map.Entry<String,byte[]> sign(SessionContext session, PublicKey key, String algo, byte[] data) throws IOException
      Parameters:
      session - The current SessionContext
      key - The PublicKey to use for signing
      algo - Recommended signature algorithm - if null/empty then one will be selected based on the key type and/or signature factories. Note: even if specific algorithm specified, the implementation may disregard and choose another
      data - Data to sign
      Returns:
      used algorithm + signed data - using the identity
      Throws:
      IOException - If failed to sign
    • resolveLocalIdentity

      default KeyPair resolveLocalIdentity(PublicKey key)
      Used for reporting client-side public key authentication via agent
      Parameters:
      key - The PublicKey that is going to be used
      Returns:
      The KeyPair identity for it - if available - null otherwise
    • addIdentity

      void addIdentity(KeyPair key, String comment, SshAgentKeyConstraint... constraints) throws IOException
      Adds a key to the agent.
      Parameters:
      key - KeyPair to add
      comment - to associate with the key
      constraints - SshAgentKeyConstraints for this key to pass on to the agent
      Throws:
      IOException - if an error in the communication with the agent occurred, or the agent did not return a reply indicating successful addition of the key
    • removeIdentity

      void removeIdentity(PublicKey key) throws IOException
      Throws:
      IOException
    • removeAllIdentities

      void removeAllIdentities() throws IOException
      Throws:
      IOException