Package org.eclipse.jgit.transport.sshd
Interface ServerKeyDatabase
- All Known Implementing Classes:
OpenSshServerKeyDatabase
public interface ServerKeyDatabase
An interface for a database of known server keys, supporting finding all
known keys and also deciding whether a server key is to be accepted.
Connection addresses are given as strings of the format
[hostName]:port
if using a non-standard port (i.e., not port 22),
otherwise just hostname
.
- Since:
- 5.5
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A simple provider for ssh config settings related to host key checking. -
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(String connectAddress, InetSocketAddress remoteAddress, PublicKey serverKey, ServerKeyDatabase.Configuration config, CredentialsProvider provider) Determines whether to accept a received server host key.lookup
(String connectAddress, InetSocketAddress remoteAddress, ServerKeyDatabase.Configuration config) Retrieves all known host keys for the given addresses.
-
Method Details
-
lookup
@NonNull List<PublicKey> lookup(@NonNull String connectAddress, @NonNull InetSocketAddress remoteAddress, @NonNull ServerKeyDatabase.Configuration config) Retrieves all known host keys for the given addresses.- Parameters:
connectAddress
- IP address the session tried to connect toremoteAddress
- IP address as reported for the remote end pointconfig
- giving access to potentially interesting configuration settings- Returns:
- the list of known keys for the given addresses
-
accept
boolean accept(@NonNull String connectAddress, @NonNull InetSocketAddress remoteAddress, @NonNull PublicKey serverKey, @NonNull ServerKeyDatabase.Configuration config, CredentialsProvider provider) Determines whether to accept a received server host key.- Parameters:
connectAddress
- IP address the session tried to connect toremoteAddress
- IP address as reported for the remote end pointserverKey
- received from the remote endconfig
- giving access to potentially interesting configuration settingsprovider
- for interacting with the user, if required; may benull
- Returns:
true
if the serverKey is accepted,false
otherwise
-