Package com.sshtools.common.hosts
Class AbstractHostKeyVerification
java.lang.Object
org.xml.sax.helpers.DefaultHandler
com.sshtools.common.hosts.AbstractHostKeyVerification
- All Implemented Interfaces:
HostKeyVerification,ContentHandler,DTDHandler,EntityResolver,ErrorHandler
- Direct Known Subclasses:
ConsoleHostKeyVerification,DialogHostKeyVerification
public abstract class AbstractHostKeyVerification
extends DefaultHandler
implements HostKeyVerification
- Version:
- $Revision: 1.13 $
- Author:
- $author$
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new AbstractHostKeyVerification object.AbstractHostKeyVerification(String hostFileName) Creates a new AbstractHostKeyVerification object. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidendElement(String uri, String localName, String qname) booleanabstract voidonDeniedHost(String host) abstract voidonHostKeyMismatch(String host, String allowedHostKey, String actualHostKey) abstract voidonUnknownHost(String host, String hostKeyFingerprint) voidremoveAllowedHost(String host) voidremoveDeniedHost(String host) voidvoidstartElement(String uri, String localName, String qname, Attributes attrs) toString()booleanverifyHost(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, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.xml.sax.ContentHandler
declaration
-
Constructor Details
-
AbstractHostKeyVerification
Creates a new AbstractHostKeyVerification object.- Throws:
InvalidHostFileException
-
AbstractHostKeyVerification
Creates a new AbstractHostKeyVerification object.- Parameters:
hostFileName-- Throws:
InvalidHostFileException
-
-
Method Details
-
startElement
public void startElement(String uri, String localName, String qname, Attributes attrs) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Parameters:
uri-localName-qname-attrs-- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Parameters:
uri-localName-qname-- Throws:
SAXException
-
isHostFileWriteable
public boolean isHostFileWriteable()- Returns:
-
onDeniedHost
- Parameters:
host-- Throws:
TransportProtocolException
-
onHostKeyMismatch
public abstract void onHostKeyMismatch(String host, String allowedHostKey, String actualHostKey) throws TransportProtocolException - Parameters:
host-allowedHostKey-actualHostKey-- Throws:
TransportProtocolException
-
onUnknownHost
public abstract void onUnknownHost(String host, String hostKeyFingerprint) throws TransportProtocolException - Parameters:
host-hostKeyFingerprint-- Throws:
TransportProtocolException
-
allowHost
public void allowHost(String host, String hostKeyFingerprint, boolean always) throws InvalidHostFileException - Parameters:
host-hostKeyFingerprint-always-- Throws:
InvalidHostFileException
-
allowedHosts
- Returns:
-
deniedHosts
- Returns:
-
removeAllowedHost
- Parameters:
host-
-
removeDeniedHost
- Parameters:
host-
-
denyHost
- Parameters:
host-always-- Throws:
InvalidHostFileException
-
verifyHost
Description copied from interface:HostKeyVerificationCalled by the transport protocol to verify the identity of the server through the supplied public key.
- Specified by:
verifyHostin interfaceHostKeyVerification- Parameters:
host-pk-- Returns:
- Throws:
TransportProtocolException
-
saveHostFile
- Throws:
InvalidHostFileException
-
toString
-