Package com.sshtools.j2ssh.transport
Class ConsoleKnownHostsKeyVerification
- java.lang.Object
-
- com.sshtools.j2ssh.transport.AbstractKnownHostsKeyVerification
-
- com.sshtools.j2ssh.transport.ConsoleKnownHostsKeyVerification
-
- All Implemented Interfaces:
HostKeyVerification
public class ConsoleKnownHostsKeyVerification extends AbstractKnownHostsKeyVerification
Implements the
AbstractKnownHostsKeyVerification
to provide host key verification through the console.- Since:
- 0.2.0
- Version:
- $Revision: 1.14 $
- Author:
- Lee David Painter
-
-
Constructor Summary
Constructors Constructor Description ConsoleKnownHostsKeyVerification()
Constructs the verification instance with the default known_hosts file from $HOME/.ssh/known_hosts.ConsoleKnownHostsKeyVerification(java.lang.String knownhosts)
Constructs the verification instance with the specified known_hosts file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onHostKeyMismatch(java.lang.String host, SshPublicKey pk, SshPublicKey actual)
Prompts the user through the console to verify the host key.void
onUnknownHost(java.lang.String host, SshPublicKey pk)
Prompts the user through the console to verify the host key.-
Methods inherited from class com.sshtools.j2ssh.transport.AbstractKnownHostsKeyVerification
allowedHosts, allowHost, isHostFileWriteable, removeAllowedHost, saveHostFile, toString, verifyHost
-
-
-
-
Constructor Detail
-
ConsoleKnownHostsKeyVerification
public ConsoleKnownHostsKeyVerification() throws InvalidHostFileException
Constructs the verification instance with the default known_hosts file from $HOME/.ssh/known_hosts.
- Throws:
InvalidHostFileException
- if the known_hosts file is invalid.- Since:
- 0.2.0
-
ConsoleKnownHostsKeyVerification
public ConsoleKnownHostsKeyVerification(java.lang.String knownhosts) throws InvalidHostFileException
Constructs the verification instance with the specified known_hosts file.
- Parameters:
knownhosts
- the path to the known_hosts file- Throws:
InvalidHostFileException
- if the known_hosts file is invalid.- Since:
- 0.2.0
-
-
Method Detail
-
onHostKeyMismatch
public void onHostKeyMismatch(java.lang.String host, SshPublicKey pk, SshPublicKey actual)
Prompts the user through the console to verify the host key.
- Specified by:
onHostKeyMismatch
in classAbstractKnownHostsKeyVerification
- Parameters:
host
- the name of the hostpk
- the current public key of the hostactual
- the actual public key supplied by the host- Since:
- 0.2.0
-
onUnknownHost
public void onUnknownHost(java.lang.String host, SshPublicKey pk)
Prompts the user through the console to verify the host key.
- Specified by:
onUnknownHost
in classAbstractKnownHostsKeyVerification
- Parameters:
host
- the name of the hostpk
- the public key supplied by the host- Since:
- 0.2.0
-
-