Class KeyAgentIdentity

java.lang.Object
org.apache.sshd.client.auth.pubkey.KeyAgentIdentity
All Implemented Interfaces:
PublicKeyIdentity

public class KeyAgentIdentity extends Object implements PublicKeyIdentity
Uses an SshAgent to generate the identity signature
  • Field Details

    • agent

      private final SshAgent agent
    • keyPair

      private final KeyPair keyPair
    • resolvedPair

      private KeyPair resolvedPair
    • comment

      private final String comment
  • Constructor Details

  • Method Details

    • getKeyIdentity

      public KeyPair getKeyIdentity()
      Specified by:
      getKeyIdentity in interface PublicKeyIdentity
      Returns:
      The KeyPair identity value
    • getComment

      public String getComment()
    • sign

      public Map.Entry<String,byte[]> sign(SessionContext session, String algo, byte[] data) throws Exception
      Description copied from interface: PublicKeyIdentity
      Proves the public key identity by signing the given data
      Specified by:
      sign in interface PublicKeyIdentity
      Parameters:
      session - The SessionContext for calling this method - may be null if not called within a session context
      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:
      Exception - If failed to sign the data
    • toString

      public String toString()
      Overrides:
      toString in class Object