com.sshtools.publickey
Class ConsoleKnownHostsKeyVerification

java.lang.Object
  extended bycom.sshtools.publickey.AbstractKnownHostsKeyVerification
      extended bycom.sshtools.publickey.ConsoleKnownHostsKeyVerification
All Implemented Interfaces:
HostKeyVerification

public class ConsoleKnownHostsKeyVerification
extends AbstractKnownHostsKeyVerification

Implements the AbstractKnownHostsKeyVerification to provide host key verification through the console.

Author:
Lee David Painter

Constructor Summary
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
 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.publickey.AbstractKnownHostsKeyVerification
allowedHosts, allowHost, isHostFileWriteable, removeAllowedHost, saveHostFile, toString, verifyHost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConsoleKnownHostsKeyVerification

public ConsoleKnownHostsKeyVerification()
                                 throws SshException

Constructs the verification instance with the default known_hosts file from $HOME/.ssh/known_hosts.

Throws:
InvalidHostFileException - if the known_hosts file is invalid.
SshException
Since:
0.2.0

ConsoleKnownHostsKeyVerification

public ConsoleKnownHostsKeyVerification(java.lang.String knownhosts)
                                 throws SshException

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.
SshException
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 class AbstractKnownHostsKeyVerification
Parameters:
host - the name of the host
pk - the current public key of the host
actual - 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 class AbstractKnownHostsKeyVerification
Parameters:
host - the name of the host
pk - the public key supplied by the host
Since:
0.2.0


Copyright © 2003 3SP LTD. All Rights Reserved.