Package com.sshtools.common.knownhosts
Class ConsoleKnownHostsFile
java.lang.Object
com.sshtools.common.knownhosts.KnownHostsKeyVerification
com.sshtools.common.knownhosts.KnownHostsFile
com.sshtools.common.knownhosts.ConsoleKnownHostsFile
- All Implemented Interfaces:
HostKeyUpdater,HostKeyVerification
-
Nested Class Summary
Nested classes/interfaces inherited from class com.sshtools.common.knownhosts.KnownHostsKeyVerification
KnownHostsKeyVerification.BlankEntry, KnownHostsKeyVerification.CertAuthorityEntry, KnownHostsKeyVerification.CommentEntry, KnownHostsKeyVerification.HostFileEntry, KnownHostsKeyVerification.InvalidEntry, KnownHostsKeyVerification.KeyEntry, KnownHostsKeyVerification.RevokedEntry, KnownHostsKeyVerification.Ssh2KeyEntry -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidonHostKeyMismatch(String host, List<SshPublicKey> allowedHostKey, SshPublicKey actual) Called by theverifyHostmethod when the host key supplied by the host does not match the current key recording in the known hosts file.protected voidonInvalidHostEntry(String entry) protected voidonRevokedKey(String host, SshPublicKey key) Called by theverifyHostmethod when the host key supplied is listed as a revoked key.voidonUnknownHost(String host, SshPublicKey pk) Prompts the user through the console to verify the host key.Methods inherited from class com.sshtools.common.knownhosts.KnownHostsFile
defaultKnownHostsFile, getFile, getKnownHostsFile, isHostFileWriteable, onHostKeyAdded, onHostKeyRemoved, onHostKeyUpdated, save, storeMethods inherited from class com.sshtools.common.knownhosts.KnownHostsKeyVerification
addEntry, addEntry, allowHost, clear, getKeyEntries, isKnownHost, load, removeEntries, removeEntries, removeEntries, removeEntry, resolveNames, setComment, setHashHosts, setUseCanonicalHostnames, setUseReverseDNS, toString, updateHostKey, useCanonicalHostname, useHashHosts, useReverseDNS, verifyHost, verifyHost
-
Constructor Details
-
ConsoleKnownHostsFile
- Throws:
SshExceptionIOException
-
ConsoleKnownHostsFile
- Throws:
SshExceptionIOException
-
ConsoleKnownHostsFile
- Throws:
SshExceptionIOException
-
-
Method Details
-
onRevokedKey
Description copied from class:KnownHostsKeyVerificationCalled by theverifyHostmethod when the host key supplied is listed as a revoked key. This is informational, any changes made to the current entries will still result in a failed host verification.- Overrides:
onRevokedKeyin classKnownHostsFile
-
onHostKeyMismatch
protected void onHostKeyMismatch(String host, List<SshPublicKey> allowedHostKey, SshPublicKey actual) throws SshException Description copied from class:KnownHostsKeyVerificationCalled by the
verifyHostmethod when the host key supplied by the host does not match the current key recording in the known hosts file.- Overrides:
onHostKeyMismatchin classKnownHostsFile- Parameters:
host- the name of the hostallowedHostKey- the current key recorded in the known_hosts file.actual- the actual key supplied by the user- Throws:
SshException- if an error occurs
-
onUnknownHost
Prompts the user through the console to verify the host key.
- Overrides:
onUnknownHostin classKnownHostsFile- Parameters:
host- the name of the hostpk- the public key supplied by the host
-
onInvalidHostEntry
- Overrides:
onInvalidHostEntryin classKnownHostsFile- Throws:
SshException
-