Top Description Inners Fields Constructors Methods
org.eclipse.jgit.internal.transport.sshd

public Class JGitServerKeyVerifier

extends Object
implements ServerKeyVerifier, ServerKeyLookup
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.internal.transport.sshd.ServerKeyLookup, org.apache.sshd.client.keyverifier.ServerKeyVerifier
Static Imports
org.eclipse.jgit.internal.transport.ssh.OpenSshConfigFile.flag

A bridge between the ServerKeyVerifier from Apache MINA sshd and our ServerKeyDatabase.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final ServerKeyDatabase
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public List<PublicKey>
lookup(ClientSession
needed to determine the config files if specified in the ssh config
session
,
SocketAddress
to find entries for
remoteAddress
)

Implements org.eclipse.jgit.internal.transport.sshd.ServerKeyLookup.lookup.

Retrieves all public keys known for a given remote.

public boolean
verifyServerKey(ClientSession
the current ClientSession
session
,
SocketAddress
the host's SocketAddress
remoteAddress
,
PublicKey
the presented server PublicKey
serverKey
)

Implements org.apache.sshd.client.keyverifier.ServerKeyVerifier.verifyServerKey.

Verify that the server key provided is really the one of the host.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databaseback to summary
private final ServerKeyDatabase database
Annotations
@NonNull
LOGback to summary
private static final Logger LOG

Constructor Detail

JGitServerKeyVerifierback to summary
public JGitServerKeyVerifier(ServerKeyDatabase database)

Creates a new JGitServerKeyVerifier using the given ServerKeyDatabase.

Parameters
database:ServerKeyDatabase

to use

Method Detail

lookupback to summary
public List<PublicKey> lookup(ClientSession session, SocketAddress remoteAddress)

Implements org.eclipse.jgit.internal.transport.sshd.ServerKeyLookup.lookup.

Doc from org.eclipse.jgit.internal.transport.sshd.ServerKeyLookup.lookup.

Retrieves all public keys known for a given remote.

Parameters
session:ClientSession

needed to determine the config files if specified in the ssh config

remoteAddress:SocketAddress

to find entries for

Returns:List<PublicKey>

a possibly empty list of entries found, including revoked ones

Annotations
@Override
verifyServerKeyback to summary
public boolean verifyServerKey(ClientSession session, SocketAddress remoteAddress, PublicKey serverKey)

Implements org.apache.sshd.client.keyverifier.ServerKeyVerifier.verifyServerKey.

Doc from org.apache.sshd.client.keyverifier.ServerKeyVerifier.verifyServerKey.

Verify that the server key provided is really the one of the host.

Parameters
session:ClientSession

the current ClientSession

remoteAddress:SocketAddress

the host's SocketAddress

serverKey:PublicKey

the presented server PublicKey

Returns:boolean

true if the key is accepted for the host

Annotations
@Override
org.eclipse.jgit.internal.transport.sshd back to summary

private Class JGitServerKeyVerifier.SessionConfig

extends Object
implements Configuration
Class Inheritance
  • java.lang.Object
  • org.eclipse.jgit.internal.transport.sshd.JGitServerKeyVerifier.SessionConfig
All Implemented Interfaces
org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration

Field Summary

Modifier and TypeField and Description
private final JGitClientSession

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private List<String>
get(String key)

public List<String>
getGlobalKnownHostsFiles()

Implements org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getGlobalKnownHostsFiles.

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

public boolean
getHashKnownHosts()

Implements org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getHashKnownHosts.

Obtains the value of the "HashKnownHosts" ssh config.

public ServerKeyDatabase.Configuration.StrictHostKeyChecking
getStrictHostKeyChecking()

Implements org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getStrictHostKeyChecking.

Obtains the value of the "StrictHostKeyChecking" ssh config.

public List<String>
getUserKnownHostsFiles()

Implements org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getUserKnownHostsFiles.

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

public String
getUsername()

Implements org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getUsername.

Obtains the user name used in the connection attempt.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sessionback to summary
private final JGitClientSession session

Constructor Detail

SessionConfigback to summary
public SessionConfig(JGitClientSession session)

Method Detail

getback to summary
private List<String> get(String key)
getGlobalKnownHostsFilesback to summary
public List<String> getGlobalKnownHostsFiles()

Implements org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getGlobalKnownHostsFiles.

Doc from org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getGlobalKnownHostsFiles.

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

Returns:List<String>

the list as configured, with ~ already replaced

Annotations
@Override
getHashKnownHostsback to summary
public boolean getHashKnownHosts()

Implements org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getHashKnownHosts.

Doc from org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getHashKnownHosts.

Obtains the value of the "HashKnownHosts" ssh config.

Returns:boolean

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

Annotations
@Override
getStrictHostKeyCheckingback to summary
public ServerKeyDatabase.Configuration.StrictHostKeyChecking getStrictHostKeyChecking()

Implements org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getStrictHostKeyChecking.

Doc from org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getStrictHostKeyChecking.

Obtains the value of the "StrictHostKeyChecking" ssh config.

Returns:ServerKeyDatabase.Configuration.StrictHostKeyChecking

the StrictHostKeyChecking

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

Implements org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getUserKnownHostsFiles.

Doc from org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getUserKnownHostsFiles.

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

Returns:List<String>

the list as configured, with ~ already replaced

Annotations
@Override
getUsernameback to summary
public String getUsername()

Implements org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getUsername.

Doc from org.eclipse.jgit.transport.sshd.ServerKeyDatabase.Configuration.getUsername.

Obtains the user name used in the connection attempt.

Returns:String

the user name

Annotations
@Override