Class ExtendedServerHostKeyVerifier
java.lang.Object
com.trilead.ssh2.ExtendedServerHostKeyVerifier
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddServerHostKey(String hostname, int port, String keyAlgorithm, byte[] serverHostKey) After authentication, if the server indicates it has anotherkeyAlgorithm, this method will be called for the app to add it to its record of known keys for thishostname.getKnownKeyAlgorithmsForHost(String hostname, int port) Called during connection to determine which keys are known for this host.abstract voidremoveServerHostKey(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.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ServerHostKeyVerifier
verifyServerHostKey
-
Constructor Details
-
ExtendedServerHostKeyVerifier
public ExtendedServerHostKeyVerifier()
-
-
Method Details
-
getKnownKeyAlgorithmsForHost
Called during connection to determine which keys are known for this host.- Parameters:
hostname- the hostname used to create theConnectionobjectport- the server's remote TCP port- Returns:
- list of hostkey algorithms for the given
hostnameandportcombination ornullif 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 theConnectionobjectport- the server's remote TCP portserverHostKeyAlgorithm- key algorithm of removed keyserverHostKey- 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 anotherkeyAlgorithm, this method will be called for the app to add it to its record of known keys for thishostname.- Parameters:
hostname- the hostname used to create theConnectionobjectport- the server's remote TCP portkeyAlgorithm- SSH standard name for the key to be addedserverHostKey- SSH encoding of the key data for the key to be added
-