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 TypeMethodDescriptionvoid
void
void
endElement
(String uri, String localName, String qname) boolean
abstract void
onDeniedHost
(String host) abstract void
onHostKeyMismatch
(String host, String allowedHostKey, String actualHostKey) abstract void
onUnknownHost
(String host, String hostKeyFingerprint) void
removeAllowedHost
(String host) void
removeDeniedHost
(String host) void
void
startElement
(String uri, String localName, String qname, Attributes attrs) toString()
boolean
verifyHost
(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
Methods 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:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Parameters:
uri
-localName
-qname
-attrs
-- Throws:
SAXException
-
endElement
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in 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:HostKeyVerification
Called by the transport protocol to verify the identity of the server through the supplied public key.
- Specified by:
verifyHost
in interfaceHostKeyVerification
- Parameters:
host
-pk
-- Returns:
- Throws:
TransportProtocolException
-
saveHostFile
- Throws:
InvalidHostFileException
-
toString
-