public class OpenSSHKnownHosts extends Object implements HostKeyVerifier
HostKeyVerifier implementation for a known_hosts file i.e. in the format used by OpenSSH.| Modifier and Type | Class and Description |
|---|---|
static class |
OpenSSHKnownHosts.AbstractEntry |
static class |
OpenSSHKnownHosts.CommentEntry |
static class |
OpenSSHKnownHosts.EntryFactory
Each line in these files contains the following fields: markers
(optional), hostnames, bits, exponent, modulus, comment.
|
static class |
OpenSSHKnownHosts.HashedEntry |
static interface |
OpenSSHKnownHosts.HostEntry |
static class |
OpenSSHKnownHosts.Marker |
static class |
OpenSSHKnownHosts.SimpleEntry |
| Modifier and Type | Field and Description |
|---|---|
protected List<OpenSSHKnownHosts.HostEntry> |
entries |
protected File |
khFile |
protected org.slf4j.Logger |
log |
| Constructor and Description |
|---|
OpenSSHKnownHosts(File khFile) |
| Modifier and Type | Method and Description |
|---|---|
static File |
detectSSHDir() |
List<OpenSSHKnownHosts.HostEntry> |
entries() |
File |
getFile() |
protected boolean |
hostKeyChangedAction(OpenSSHKnownHosts.HostEntry entry,
String hostname,
PublicKey key) |
protected boolean |
hostKeyUnverifiableAction(String hostname,
PublicKey key) |
boolean |
verify(String hostname,
int port,
PublicKey key)
This callback is invoked when the server's host key needs to be verified.
|
void |
write() |
void |
write(OpenSSHKnownHosts.HostEntry entry)
Append a single entry
|
protected final org.slf4j.Logger log
protected final File khFile
protected final List<OpenSSHKnownHosts.HostEntry> entries
public OpenSSHKnownHosts(File khFile) throws IOException
IOExceptionpublic File getFile()
public boolean verify(String hostname, int port, PublicKey key)
HostKeyVerifierverify in interface HostKeyVerifierhostname - remote hostnameport - remote portkey - host key of servertrue if key is acceptable, false otherwiseprotected boolean hostKeyUnverifiableAction(String hostname, PublicKey key)
protected boolean hostKeyChangedAction(OpenSSHKnownHosts.HostEntry entry, String hostname, PublicKey key)
public List<OpenSSHKnownHosts.HostEntry> entries()
public void write()
throws IOException
IOExceptionpublic void write(OpenSSHKnownHosts.HostEntry entry) throws IOException
IOExceptionpublic static File detectSSHDir()
Copyright © 2009–2014. All rights reserved.