Top Description Inners Methods
org.eclipse.jgit.transport.sshd

public Interface ServerKeyDatabase

Known Direct Implementers
org.eclipse.jgit.internal.transport.sshd.OpenSshServerKeyDatabase
Imports
java.net.InetSocketAddress, java.security.PublicKey, java.util.List, org.eclipse.jgit.annotations.NonNull, org.eclipse.jgit.transport.CredentialsProvider

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 and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ServerKeyDatabase.Configuration

A simple provider for ssh config settings related to host key checking.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the serverKey is accepted, false otherwise
accept
(String
IP address the session tried to connect to
connectAddress
,
InetSocketAddress
IP address as reported for the remote end point
remoteAddress
,
PublicKey
received from the remote end
serverKey
,
ServerKeyDatabase.Configuration
giving access to potentially interesting configuration settings
config
,
CredentialsProvider
for interacting with the user, if required; may be null
provider
)

Determines whether to accept a received server host key.

public List<PublicKey>

Returns:

the list of known and not revoked keys for the given addresses
lookup
(String
IP address the session tried to connect to
connectAddress
,
InetSocketAddress
IP address as reported for the remote end point
remoteAddress
,
ServerKeyDatabase.Configuration
giving access to potentially interesting configuration settings
config
)

Retrieves all known and not revoked host keys for the given addresses.

Method Detail

acceptback to summary
public boolean accept(String connectAddress, InetSocketAddress remoteAddress, PublicKey serverKey, ServerKeyDatabase.Configuration config, CredentialsProvider provider)

Determines whether to accept a received server host key.

Parameters
connectAddress:String

IP address the session tried to connect to

remoteAddress:InetSocketAddress

IP address as reported for the remote end point

serverKey:PublicKey

received from the remote end

config:ServerKeyDatabase.Configuration

giving access to potentially interesting configuration settings

provider:CredentialsProvider

for interacting with the user, if required; may be null

Returns:boolean

true if the serverKey is accepted, false otherwise

lookupback to summary
public List<PublicKey> lookup(String connectAddress, InetSocketAddress remoteAddress, ServerKeyDatabase.Configuration config)

Retrieves all known and not revoked host keys for the given addresses.

Parameters
connectAddress:String

IP address the session tried to connect to

remoteAddress:InetSocketAddress

IP address as reported for the remote end point

config:ServerKeyDatabase.Configuration

giving access to potentially interesting configuration settings

Returns:List<PublicKey>

the list of known and not revoked keys for the given addresses

Annotations
@NonNull
org.eclipse.jgit.transport.sshd back to summary

public Interface ServerKeyDatabase.Configuration

Known Direct Implementers
org.eclipse.jgit.internal.transport.sshd.JGitServerKeyVerifier.SessionConfig

A simple provider for ssh config settings related to host key checking. An instance is created by the JGit sshd framework and passed into ServerKeyDatabase#lookup(String, InetSocketAddress, Configuration) and ServerKeyDatabase#accept(String, InetSocketAddress, PublicKey, Configuration, CredentialsProvider).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
ServerKeyDatabase.Configuration.StrictHostKeyChecking

The possible values for the "StrictHostKeyChecking" ssh config.

Method Summary

Modifier and TypeMethod and Description
public List<String>

Returns:

the list as configured, with ~ already replaced
getGlobalKnownHostsFiles
()

Retrieves the list of file names from the "GlobalKnownHostsFile" ssh config.

public boolean

Returns:

true if new entries should be stored with hashed host information, false otherwise
getHashKnownHosts
()

Obtains the value of the "HashKnownHosts" ssh config.

public ServerKeyDatabase.Configuration.StrictHostKeyChecking
getStrictHostKeyChecking()

Obtains the value of the "StrictHostKeyChecking" ssh config.

public List<String>

Returns:

the list as configured, with ~ already replaced
getUserKnownHostsFiles
()

Retrieves the list of file names from the "UserKnownHostsFile" ssh config.

public String

Returns:

the user name
getUsername
()

Obtains the user name used in the connection attempt.

Method Detail

getGlobalKnownHostsFilesback to summary
public List<String> getGlobalKnownHostsFiles()

Retrieves the list of file names from the "GlobalKnownHostsFile" ssh config.

Returns:List<String>

the list as configured, with ~ already replaced

getHashKnownHostsback to summary
public boolean getHashKnownHosts()

Obtains the value of the "HashKnownHosts" ssh config.

Returns:boolean

true if new entries should be stored with hashed host information, false otherwise

getStrictHostKeyCheckingback to summary
public ServerKeyDatabase.Configuration.StrictHostKeyChecking getStrictHostKeyChecking()

Obtains the value of the "StrictHostKeyChecking" ssh config.

Returns:ServerKeyDatabase.Configuration.StrictHostKeyChecking

the StrictHostKeyChecking

Annotations
@NonNull
getUserKnownHostsFilesback to summary
public List<String> getUserKnownHostsFiles()

Retrieves the list of file names from the "UserKnownHostsFile" ssh config.

Returns:List<String>

the list as configured, with ~ already replaced

getUsernameback to summary
public String getUsername()

Obtains the user name used in the connection attempt.

Returns:String

the user name

Annotations
@NonNull
org.eclipse.jgit.transport.sshd back to summary

public final Enum ServerKeyDatabase.Configuration.StrictHostKeyChecking

extends Enum<ServerKeyDatabase.Configuration.StrictHostKeyChecking>
Class Inheritance

The possible values for the "StrictHostKeyChecking" ssh config.

Field Summary

Modifier and TypeField and Description
public static final ServerKeyDatabase.Configuration.StrictHostKeyChecking
ACCEPT_ANY

"no", "off": always accept new or mismatched keys.

public static final ServerKeyDatabase.Configuration.StrictHostKeyChecking
ACCEPT_NEW

"accept-new": accept new keys, but never accept modified keys.

public static final ServerKeyDatabase.Configuration.StrictHostKeyChecking
ASK

"ask"; default: ask the user whether to accept (and store) a new or mismatched key.

public static final ServerKeyDatabase.Configuration.StrictHostKeyChecking
REQUIRE_MATCH

"yes", "on": never accept new or mismatched keys.

Constructor Summary

AccessConstructor and Description
private

Field Detail

ACCEPT_ANYback to summary
public static final ServerKeyDatabase.Configuration.StrictHostKeyChecking ACCEPT_ANY

"no", "off": always accept new or mismatched keys.

ACCEPT_NEWback to summary
public static final ServerKeyDatabase.Configuration.StrictHostKeyChecking ACCEPT_NEW

"accept-new": accept new keys, but never accept modified keys.

ASKback to summary
public static final ServerKeyDatabase.Configuration.StrictHostKeyChecking ASK

"ask"; default: ask the user whether to accept (and store) a new or mismatched key.

REQUIRE_MATCHback to summary
public static final ServerKeyDatabase.Configuration.StrictHostKeyChecking REQUIRE_MATCH

"yes", "on": never accept new or mismatched keys.

Constructor Detail

StrictHostKeyCheckingback to summary
private StrictHostKeyChecking()