public class KnownHostsFile extends KnownHostsKeyVerification
KnownHostsKeyVerification.BlankEntry, KnownHostsKeyVerification.CertAuthorityEntry, KnownHostsKeyVerification.CommentEntry, KnownHostsKeyVerification.HostFileEntry, KnownHostsKeyVerification.InvalidEntry, KnownHostsKeyVerification.KeyEntry, KnownHostsKeyVerification.RevokedEntry, KnownHostsKeyVerification.Ssh2KeyEntry
Constructor and Description |
---|
KnownHostsFile() |
KnownHostsFile(File file) |
Modifier and Type | Method and Description |
---|---|
File |
getKnownHostsFile() |
boolean |
isHostFileWriteable() |
protected void |
onHostKeyAdded(Set<String> names,
SshPublicKey key) |
protected void |
onHostKeyMismatch(String host,
List<SshPublicKey> allowedHostKey,
SshPublicKey actualHostKey)
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 |
onHostKeyRemoved(Set<String> names,
SshPublicKey key) |
protected void |
onHostKeyUpdated(Set<String> names,
SshPublicKey key) |
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. |
protected void |
onUnknownHost(String host,
SshPublicKey key)
Called by the
verifyHost method when the host key supplied
is not recorded in the known_hosts file. |
protected void |
save() |
void |
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 KnownHostsFile(File file) throws SshException
SshException
public KnownHostsFile() throws SshException
SshException
public void store() throws IOException
IOException
public File getKnownHostsFile()
public boolean isHostFileWriteable()
isHostFileWriteable
in class KnownHostsKeyVerification
protected void onInvalidHostEntry(String entry) throws SshException
onInvalidHostEntry
in class KnownHostsKeyVerification
SshException
protected void onHostKeyMismatch(String host, List<SshPublicKey> allowedHostKey, SshPublicKey actualHostKey) 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 KnownHostsKeyVerification
host
- the name of the hostallowedHostKey
- the current key recorded in the known_hosts file.actualHostKey
- the actual key supplied by the userSshException
- if an error occursprotected void onUnknownHost(String host, SshPublicKey key) throws SshException
KnownHostsKeyVerification
Called by the verifyHost
method when the host key supplied
is not recorded in the known_hosts file.
onUnknownHost
in class KnownHostsKeyVerification
host
- the name of the hostkey
- the public key supplied by the hostSshException
- if an error occursprotected 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 KnownHostsKeyVerification
protected void onHostKeyUpdated(Set<String> names, SshPublicKey key)
onHostKeyUpdated
in class KnownHostsKeyVerification
protected void onHostKeyAdded(Set<String> names, SshPublicKey key)
onHostKeyAdded
in class KnownHostsKeyVerification
protected void onHostKeyRemoved(Set<String> names, SshPublicKey key)
onHostKeyRemoved
in class KnownHostsKeyVerification
protected void save()
Copyright © 2024. All rights reserved.