public class ConsoleKnownHostsFile extends KnownHostsFile
KnownHostsKeyVerification.BlankEntry, KnownHostsKeyVerification.CertAuthorityEntry, KnownHostsKeyVerification.CommentEntry, KnownHostsKeyVerification.HostFileEntry, KnownHostsKeyVerification.InvalidEntry, KnownHostsKeyVerification.KeyEntry, KnownHostsKeyVerification.RevokedEntry, KnownHostsKeyVerification.Ssh2KeyEntry| Constructor and Description |
|---|
ConsoleKnownHostsFile() |
ConsoleKnownHostsFile(File file) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
onHostKeyMismatch(String host,
List<SshPublicKey> allowedHostKey,
SshPublicKey actual)
Called by the
verifyHost method when the host key supplied
by the host does not match the current key recording in the known hosts
file. |
protected void |
onInvalidHostEntry(String entry) |
protected void |
onRevokedKey(String host,
SshPublicKey key)
Called by the
verifyHost method when the host key supplied
is listed as a revoked key. |
void |
onUnknownHost(String host,
SshPublicKey pk)
Prompts the user through the console to verify the host key.
|
getKnownHostsFile, isHostFileWriteable, onHostKeyAdded, onHostKeyRemoved, onHostKeyUpdated, save, storeaddEntry, addListener, allowHost, clear, encodeHost, encodeHost, getAlgorithmsForHost, getKeyEntries, isKnownHost, load, removeEntries, removeEntries, removeEntries, removeEntries, removeEntry, resolveNames, setComment, setHashHosts, setUseCanonicalHostnames, setUseReverseDNS, toString, updateHostKey, useCanonicalHostname, useHashHosts, useReverseDNS, verifyHostpublic ConsoleKnownHostsFile()
throws SshException,
IOException
SshExceptionIOExceptionpublic ConsoleKnownHostsFile(File file) throws SshException, IOException
SshExceptionIOExceptionprotected void onRevokedKey(String host, SshPublicKey key)
KnownHostsKeyVerificationverifyHost method 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.onRevokedKey in class KnownHostsFileprotected void onHostKeyMismatch(String host, List<SshPublicKey> allowedHostKey, SshPublicKey actual) throws SshException
KnownHostsKeyVerification
Called by the verifyHost method when the host key supplied
by the host does not match the current key recording in the known hosts
file.
onHostKeyMismatch in class KnownHostsFilehost - the name of the hostallowedHostKey - the current key recorded in the known_hosts file.actual - the actual key supplied by the userSshException - if an error occurspublic void onUnknownHost(String host, SshPublicKey pk)
Prompts the user through the console to verify the host key.
onUnknownHost in class KnownHostsFilehost - the name of the hostpk - the public key supplied by the hostprotected void onInvalidHostEntry(String entry) throws SshException
onInvalidHostEntry in class KnownHostsFileSshExceptionCopyright © 2025. All rights reserved.