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, store
addEntry, addListener, allowHost, clear, getAlgorithmsForHost, getKeyEntries, isKnownHost, load, removeEntries, removeEntries, removeEntries, removeEntries, removeEntry, resolveNames, setComment, setHashHosts, setUseCanonicalHostnames, setUseReverseDNS, toString, updateHostKey, useCanonicalHostname, useHashHosts, useReverseDNS, verifyHost
public ConsoleKnownHostsFile() throws SshException, IOException
SshException
IOException
public ConsoleKnownHostsFile(File file) throws SshException, IOException
SshException
IOException
protected void onRevokedKey(String host, SshPublicKey key)
KnownHostsKeyVerification
verifyHost
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 KnownHostsFile
protected 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 KnownHostsFile
host
- 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 KnownHostsFile
host
- the name of the hostpk
- the public key supplied by the hostprotected void onInvalidHostEntry(String entry) throws SshException
onInvalidHostEntry
in class KnownHostsFile
SshException
Copyright © 2024. All rights reserved.