com.sshtools.common.hosts
Class AbstractHostKeyVerification

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.sshtools.common.hosts.AbstractHostKeyVerification
All Implemented Interfaces:
HostKeyVerification, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Direct Known Subclasses:
ConsoleHostKeyVerification, DialogHostKeyVerification

public abstract class AbstractHostKeyVerification
extends org.xml.sax.helpers.DefaultHandler
implements HostKeyVerification

Version:
$Revision: 1.13 $
Author:
$author$

Constructor Summary
AbstractHostKeyVerification()
          Creates a new AbstractHostKeyVerification object.
AbstractHostKeyVerification(java.lang.String hostFileName)
          Creates a new AbstractHostKeyVerification object.
 
Method Summary
 java.util.Map allowedHosts()
           
 void allowHost(java.lang.String host, java.lang.String hostKeyFingerprint, boolean always)
           
 java.util.List deniedHosts()
           
 void denyHost(java.lang.String host, boolean always)
           
 void endElement(java.lang.String uri, java.lang.String localName, java.lang.String qname)
           
 boolean isHostFileWriteable()
           
abstract  void onDeniedHost(java.lang.String host)
           
abstract  void onHostKeyMismatch(java.lang.String host, java.lang.String allowedHostKey, java.lang.String actualHostKey)
           
abstract  void onUnknownHost(java.lang.String host, java.lang.String hostKeyFingerprint)
           
 void removeAllowedHost(java.lang.String host)
           
 void removeDeniedHost(java.lang.String host)
           
 void saveHostFile()
           
 void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qname, org.xml.sax.Attributes attrs)
           
 java.lang.String toString()
           
 boolean verifyHost(java.lang.String host, SshPublicKey pk)
           Called by the transport protocol to verify the identity of the server through the supplied public key.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractHostKeyVerification

public AbstractHostKeyVerification()
                            throws InvalidHostFileException
Creates a new AbstractHostKeyVerification object.

Throws:
InvalidHostFileException

AbstractHostKeyVerification

public AbstractHostKeyVerification(java.lang.String hostFileName)
                            throws InvalidHostFileException
Creates a new AbstractHostKeyVerification object.

Parameters:
hostFileName -
Throws:
InvalidHostFileException
Method Detail

startElement

public void startElement(java.lang.String uri,
                         java.lang.String localName,
                         java.lang.String qname,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri -
localName -
qname -
attrs -
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String uri,
                       java.lang.String localName,
                       java.lang.String qname)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
Parameters:
uri -
localName -
qname -
Throws:
org.xml.sax.SAXException

isHostFileWriteable

public boolean isHostFileWriteable()
Returns:

onDeniedHost

public abstract void onDeniedHost(java.lang.String host)
                           throws TransportProtocolException
Parameters:
host -
Throws:
TransportProtocolException

onHostKeyMismatch

public abstract void onHostKeyMismatch(java.lang.String host,
                                       java.lang.String allowedHostKey,
                                       java.lang.String actualHostKey)
                                throws TransportProtocolException
Parameters:
host -
allowedHostKey -
actualHostKey -
Throws:
TransportProtocolException

onUnknownHost

public abstract void onUnknownHost(java.lang.String host,
                                   java.lang.String hostKeyFingerprint)
                            throws TransportProtocolException
Parameters:
host -
hostKeyFingerprint -
Throws:
TransportProtocolException

allowHost

public void allowHost(java.lang.String host,
                      java.lang.String hostKeyFingerprint,
                      boolean always)
               throws InvalidHostFileException
Parameters:
host -
hostKeyFingerprint -
always -
Throws:
InvalidHostFileException

allowedHosts

public java.util.Map allowedHosts()
Returns:

deniedHosts

public java.util.List deniedHosts()
Returns:

removeAllowedHost

public void removeAllowedHost(java.lang.String host)
Parameters:
host -

removeDeniedHost

public void removeDeniedHost(java.lang.String host)
Parameters:
host -

denyHost

public void denyHost(java.lang.String host,
                     boolean always)
              throws InvalidHostFileException
Parameters:
host -
always -
Throws:
InvalidHostFileException

verifyHost

public boolean verifyHost(java.lang.String host,
                          SshPublicKey pk)
                   throws TransportProtocolException
Description copied from interface: HostKeyVerification

Called by the transport protocol to verify the identity of the server through the supplied public key.

Specified by:
verifyHost in interface HostKeyVerification
Parameters:
host -
pk -
Returns:
Throws:
TransportProtocolException

saveHostFile

public void saveHostFile()
                  throws InvalidHostFileException
Throws:
InvalidHostFileException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:


Copyright © 2002-2003 Lee David Painter & Contributors. All Rights Reserved.