Interface HostKeyVerifier
-
- All Known Implementing Classes:
ConsoleKnownHostsVerifier
,FingerprintVerifier
,OpenSSHKnownHosts
,PromiscuousVerifier
public interface HostKeyVerifier
Host key verification interface.
-
-
Method Summary
Modifier and Type Method Description java.util.List<java.lang.String>
findExistingAlgorithms(java.lang.String hostname, int port)
It is necessary to connect with the type of algorithm that matches an existing know_host entry.boolean
verify(java.lang.String hostname, int port, java.security.PublicKey key)
This callback is invoked when the server's host key needs to be verified.
-
-
-
Method Detail
-
verify
boolean verify(java.lang.String hostname, int port, java.security.PublicKey key)
This callback is invoked when the server's host key needs to be verified. The return value indicates to the caller whether the SSH connection should proceed. Note: host key verification is the basis for security in SSH, therefore exercise due caution in implementing!- Parameters:
hostname
- remote hostnameport
- remote portkey
- host key of server- Returns:
true
if key is acceptable,false
otherwise
-
findExistingAlgorithms
java.util.List<java.lang.String> findExistingAlgorithms(java.lang.String hostname, int port)
It is necessary to connect with the type of algorithm that matches an existing know_host entry. This will allow a match when we later verify with the negotiated keyHostKeyVerifier.verify
- Parameters:
hostname
- remote hostnameport
- remote port- Returns:
- existing key types or empty list if no keys known for hostname
-
-