Package com.trilead.ssh2
Class ExtendedServerHostKeyVerifier
- java.lang.Object
-
- com.trilead.ssh2.ExtendedServerHostKeyVerifier
-
- All Implemented Interfaces:
ServerHostKeyVerifier
public abstract class ExtendedServerHostKeyVerifier extends java.lang.Object implements ServerHostKeyVerifier
This extends theServerHostKeyVerifier
interface by allowing the remote server to indicate it has multiple server key algorithms available. After authentication, thegetKnownKeyAlgorithmsForHost(String, int)
method may be called and compared against the list of server-controller keys. If a key algorithm has been added thenaddServerHostKey(String, int, String, byte[])
will be called. If a key algorithm has been removed, thenremoveServerHostKey(String, int, String, byte[])
will be called.- Author:
- Kenny Root
-
-
Constructor Summary
Constructors Constructor Description ExtendedServerHostKeyVerifier()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract void
addServerHostKey(java.lang.String hostname, int port, java.lang.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
.abstract java.util.List<java.lang.String>
getKnownKeyAlgorithmsForHost(java.lang.String hostname, int port)
Called during connection to determine which keys are known for this host.abstract void
removeServerHostKey(java.lang.String hostname, int port, java.lang.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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.trilead.ssh2.ServerHostKeyVerifier
verifyServerHostKey
-
-
-
-
Method Detail
-
getKnownKeyAlgorithmsForHost
public abstract java.util.List<java.lang.String> getKnownKeyAlgorithmsForHost(java.lang.String hostname, int port)
Called during connection to determine which keys are known for this host.- Parameters:
hostname
- the hostname used to create theConnection
objectport
- the server's remote TCP port- Returns:
- list of hostkey algorithms for the given
hostname
andport
combination ornull
if none are known.
-
removeServerHostKey
public abstract void removeServerHostKey(java.lang.String hostname, int port, java.lang.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 theConnection
objectport
- the server's remote TCP portserverHostKeyAlgorithm
- key algorithm of removed keyserverHostKey
- key data of removed key
-
addServerHostKey
public abstract void addServerHostKey(java.lang.String hostname, int port, java.lang.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 theConnection
objectport
- 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
-
-