Class ExtendedServerHostKeyVerifier

java.lang.Object
com.trilead.ssh2.ExtendedServerHostKeyVerifier
All Implemented Interfaces:
ServerHostKeyVerifier

public abstract class ExtendedServerHostKeyVerifier extends Object implements ServerHostKeyVerifier
This extends the ServerHostKeyVerifier interface by allowing the remote server to indicate it has multiple server key algorithms available. After authentication, the getKnownKeyAlgorithmsForHost(String, int) method may be called and compared against the list of server-controller keys. If a key algorithm has been added then addServerHostKey(String, int, String, byte[]) will be called. If a key algorithm has been removed, then removeServerHostKey(String, int, String, byte[]) will be called.
Author:
Kenny Root
  • Constructor Details

    • ExtendedServerHostKeyVerifier

      public ExtendedServerHostKeyVerifier()
  • Method Details

    • getKnownKeyAlgorithmsForHost

      public abstract List<String> getKnownKeyAlgorithmsForHost(String hostname, int port)
      Called during connection to determine which keys are known for this host.
      Parameters:
      hostname - the hostname used to create the Connection object
      port - the server's remote TCP port
      Returns:
      list of hostkey algorithms for the given hostname and port combination or null if none are known.
    • removeServerHostKey

      public abstract void removeServerHostKey(String hostname, int port, String serverHostKeyAlgorithm, byte[] serverHostKey)
      After authentication, if the server indicates it no longer uses this key, this method will be called for the app to remove its record of it.
      Parameters:
      hostname - the hostname used to create the Connection object
      port - the server's remote TCP port
      serverHostKeyAlgorithm - key algorithm of removed key
      serverHostKey - key data of removed key
    • addServerHostKey

      public abstract void addServerHostKey(String hostname, int port, String keyAlgorithm, byte[] serverHostKey)
      After authentication, if the server indicates it has another keyAlgorithm, this method will be called for the app to add it to its record of known keys for this hostname.
      Parameters:
      hostname - the hostname used to create the Connection object
      port - the server's remote TCP port
      keyAlgorithm - SSH standard name for the key to be added
      serverHostKey - SSH encoding of the key data for the key to be added