Class PublicKeyAuthenticator

java.lang.Object
com.sshtools.common.ssh.AbstractRequestFuture
com.sshtools.client.SimpleClientAuthenticator
com.sshtools.client.PublicKeyAuthenticator
All Implemented Interfaces:
ClientAuthenticator, com.sshtools.common.ssh.RequestFuture
Direct Known Subclasses:
ExternalKeyAuthenticator, IdentityFileAuthenticator, KeyPairAuthenticator, PrivateKeyFileAuthenticator

public abstract class PublicKeyAuthenticator extends SimpleClientAuthenticator implements ClientAuthenticator
Implements public key authentication taking a separately loaded SshKeyPair as the private key for authentication.
  • Field Details

    • SSH_MSG_USERAUTH_PK_OK

      public static final int SSH_MSG_USERAUTH_PK_OK
      See Also:
  • Constructor Details

    • PublicKeyAuthenticator

      public PublicKeyAuthenticator()
  • Method Details

    • authenticate

      public void authenticate(TransportProtocolClient transport, String username) throws IOException, com.sshtools.common.ssh.SshException
      Description copied from interface: ClientAuthenticator
      Start the authentication
      Specified by:
      authenticate in interface ClientAuthenticator
      Throws:
      IOException
      com.sshtools.common.ssh.SshException
    • onStartAuthentication

      protected void onStartAuthentication(com.sshtools.synergy.ssh.Connection<SshClientContext> con)
    • getNextKey

      protected abstract com.sshtools.common.ssh.components.SshPublicKey getNextKey() throws IOException
      Throws:
      IOException
    • getAuthenticatingKey

      protected abstract com.sshtools.common.ssh.components.SshKeyPair getAuthenticatingKey() throws IOException, com.sshtools.common.publickey.InvalidPassphraseException
      Throws:
      IOException
      com.sshtools.common.publickey.InvalidPassphraseException
    • hasCredentialsRemaining

      protected abstract boolean hasCredentialsRemaining()
    • getSignatureGenerator

      protected com.sshtools.common.publickey.SignatureGenerator getSignatureGenerator() throws IOException, com.sshtools.common.publickey.InvalidPassphraseException
      Throws:
      IOException
      com.sshtools.common.publickey.InvalidPassphraseException
    • processMessage

      public boolean processMessage(com.sshtools.common.util.ByteArrayReader msg) throws IOException, com.sshtools.common.ssh.SshException
      Description copied from interface: ClientAuthenticator
      Process an authentication message.
      Specified by:
      processMessage in interface ClientAuthenticator
      Overrides:
      processMessage in class SimpleClientAuthenticator
      Returns:
      Throws:
      IOException
      com.sshtools.common.ssh.SshException
    • sign

      public byte[] sign(com.sshtools.common.ssh.components.SshPrivateKey prv, String signingAlgorithm, byte[] data) throws com.sshtools.common.ssh.SshException
      Throws:
      com.sshtools.common.ssh.SshException
    • getName

      public String getName()
      Description copied from interface: ClientAuthenticator
      The authentication mechanism name/.
      Specified by:
      getName in interface ClientAuthenticator
      Returns: