| Modifier and Type | Class and Description |
|---|---|
| public static class | KnownHostsServerKeyVerifier.
Represents an entry in the internal verifier's cache |
| Modifier and Type | Field and Description |
|---|---|
| private final ServerKeyVerifier | |
| private final AtomicReference | |
| public static final String | KNOWN_HOSTS_FILE_OPTION
Standard option used to indicate alternative known hosts file location |
| private ModifiedServerKeyAcceptor | |
| public static final String | STRICT_CHECKING_OPTION
Standard option used to indicate whether to use strict host key checking or not. |
| protected final Object |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | Returns: true if accept the server key anywayThe clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, PublicKey The presented server serverKey, Throwable PublicKeyThe reason)Throwable that indicates the reload failureCalled if failed to reload known hosts - by default invokes
|
| protected boolean | acceptKnownHostEntries(ClientSession clientSession, SocketAddress remoteAddress, PublicKey serverKey, Collection<KnownHostsServerKeyVerifier.
|
| public boolean | acceptModifiedServerKey(ClientSession
The clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, KnownHostEntry Any original entry, PublicKey KnownHostEntry whose key did not matchAny expected server expected, PublicKey PublicKeyThe presented server actual)PublicKeyImplements org. Invoked when a matching known host key was found but it does not match the presented one. |
| protected boolean | Returns: true if accept the server keyThe clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, PublicKey The presented server serverKey)PublicKeyInvoked if none of the known hosts matches the current one - by default invokes the delegate. |
| protected List | findKnownHostEntries(ClientSession clientSession, SocketAddress remoteAddress, Collection<KnownHostsServerKeyVerifier.
|
| public ServerKeyVerifier | |
| protected PublicKeyEntryResolver | |
| protected NamedFactory | getHostValueDigester(ClientSession
The clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, SshdSocketAddress The entry's host name/address hostIdentity)Invoked by |
| protected Supplier | |
| public ModifiedServerKeyAcceptor | Returns: The delegateModifiedServerKeyAcceptor to consult if a server presents a modified key. If
null then assumed to reject such a modification
|
| protected void | handleKnownHostsFileUpdateFailure(ClientSession
The clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, PublicKey The server serverKey, Path PublicKey that was attempted to updateThe file file, Collection<KnownHostsServerKeyVerifier.Path to be updatedThe currently known entries (may be knownHosts,null/emptyThe failure reason reason)Invoked when Note there is a chance that the file is now corrupted and cannot be re-used, so we provide a way to recover it via overriding this method and using the cached entries to re-created it. |
| protected void | handleModifiedServerKeyUpdateFailure(ClientSession
The clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, KnownHostsServerKeyVerifier.The match,HostEntryPair whose key does not matchThe presented server serverKey, Path PublicKey to be updatedThe file file, Collection<KnownHostsServerKeyVerifier.Path to be updatedThe currently cached entries (may be knownHosts,null/empty)The failure reason reason)Invoked if |
| protected void | handleRevokedKey(ClientSession
The clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, PublicKey The presented server serverKey)PublicKeyInvoked if any matching host entry has a 'revoked' marker |
| protected KnownHostEntry | prepareKnownHostEntry(ClientSession
The clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, PublicKey The server serverKey)PublicKey that was attempted to updateInvoked by |
| protected String | Returns: The updated line - ignored ifnull/empty or same as original oneThe clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, KnownHostEntry The entry, String KnownHostEntryThe current entry line data curLine, PublicKey The expected expected, PublicKey PublicKeyThe present key to be update actual)Invoked by
|
| protected List | reloadKnownHosts(ClientSession
The session, Path ClientSession that triggered this requestThe file)Path to reload from
|
| protected PublicKey | resolveHostKey(ClientSession
The session, KnownHostEntry ClientSession that triggered this requestThe entry, PublicKeyEntryResolver KnownHostEntry - ignored if nullThe resolver)PublicKeyEntryResolver to use if immediate - decoding does not work
- ignored if nullRecover the associated public key from a known host entry |
| protected Collection | Returns: ACollection of the InetSocketAddress-es to use - if null/empty
then ignored (i.e., no matching is done or no entry is generated)The clientSession, SocketAddress ClientSessionThe remote host address remoteAddress)Retrieves the host identities to be used when matching or updating an entry for it - by default returns the reported remote address and the original connection target host name/address (if same, then only one value is returned) |
| protected void | |
| public void | setModifiedServerKeyAcceptor(ModifiedServerKeyAcceptor
The delegate acceptor)ModifiedServerKeyAcceptor to consult if a server presents a modified key. If
null then assumed to reject such a modification
|
| protected KnownHostEntry | Returns: The generatedKnownHostEntry or null if nothing updated. If anything
updated then the file will be re-loaded on next verification regardless of which server is
verifiedThe clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, PublicKey The server serverKey, Path PublicKey that to updateThe file file, Collection<KnownHostsServerKeyVerifier.Path to be updatedThe currently cached entries (may be knownHostsnull/empty)Invoked if a new previously unknown host key has been accepted - by default appends a new entry at the end of the currently monitored known hosts file |
| protected void | updateModifiedServerKey(ClientSession clientSession, SocketAddress remoteAddress, PublicKey serverKey, Collection<KnownHostsServerKeyVerifier.
|
| protected void | updateModifiedServerKey(ClientSession
The clientSession, SocketAddress ClientSessionThe remote host address remoteAddress, KnownHostsServerKeyVerifier.The match,HostEntryPair whose key does not matchThe presented server actual, Path PublicKey to be updatedThe file file, Collection<KnownHostsServerKeyVerifier.Path to be updatedThe currently loaded entries knownHostsInvoked if a matching host entry was found, but the key did not match and
|
| public boolean | verifyServerKey(ClientSession
the current clientSession, SocketAddress ClientSessionthe host's remoteAddress, PublicKey SocketAddressthe presented server serverKey)PublicKeyImplements org. Verify that the server key provided is really the one of the host. |