Top Fields Methods
org.apache.sshd.client.config.keys

public Interface ClientIdentityLoader

Imports
java.io.IOException, .InputStream, java.nio.file.Files, .Path, .Paths, java.security.GeneralSecurityException, .KeyPair, java.util.Collection, .Objects, org.apache.sshd.common.NamedResource, org.apache.sshd.common.config.keys.FilePasswordProvider, org.apache.sshd.common.keyprovider.KeyIdentityProvider, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.GenericUtils, .ValidateUtils, org.apache.sshd.common.util.io.IoUtils, org.apache.sshd.common.util.io.resource.PathResource, org.apache.sshd.common.util.security.SecurityUtils

Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final ClientIdentityLoader
DEFAULT

A default implementation that assumes a file location that must exist

Method Summary

Modifier and TypeMethod and Description
public static KeyIdentityProvider

Returns:

The KeyIdentityProvider wrapper
asKeyIdentityProvider
(ClientIdentityLoader
The loader instance to use
loader
,
Collection<? extends NamedResource>
The locations to load - ignored if null/empty
locations
,
FilePasswordProvider
The FilePasswordProvider to use if any encrypted keys found
passwordProvider
,
boolean
Whether to ignore non existing locations as indicated by isValidLocation(NamedResource)
ignoreNonExisting
)

Uses the provided ClientIdentityLoader to lazy load the keys locations

public boolean

Returns:

true if it represents a valid location - the actual meaning of the validity depends on the implementation
isValidLocation
(NamedResource
The identity key-pair location - the actual meaning (file, URL, etc.) depends on the implementation.
location
)

public Iterable<KeyPair>

Returns:

The loaded KeyPair - null if location is empty and it is OK that it does not exist
loadClientIdentities
(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool).
session
,
NamedResource
The identity key-pair location - the actual meaning (file, URL, etc.) depends on the implementation.
location
,
FilePasswordProvider
The FilePasswordProvider to consult if the location contains an encrypted identity
provider
)

Field Detail

DEFAULTback to summary
public static final ClientIdentityLoader DEFAULT

A default implementation that assumes a file location that must exist

Method Detail

asKeyIdentityProviderback to summary
public static KeyIdentityProvider asKeyIdentityProvider(ClientIdentityLoader loader, Collection<? extends NamedResource> locations, FilePasswordProvider passwordProvider, boolean ignoreNonExisting)

Uses the provided ClientIdentityLoader to lazy load the keys locations

Parameters
loader:ClientIdentityLoader

The loader instance to use

locations:Collection<? extends NamedResource>

The locations to load - ignored if null/empty

passwordProvider:FilePasswordProvider

The FilePasswordProvider to use if any encrypted keys found

ignoreNonExisting:boolean

Whether to ignore non existing locations as indicated by isValidLocation(NamedResource)

Returns:KeyIdentityProvider

The KeyIdentityProvider wrapper

isValidLocationback to summary
public boolean isValidLocation(NamedResource location) throws IOException
Parameters
location:NamedResource

The identity key-pair location - the actual meaning (file, URL, etc.) depends on the implementation.

Returns:boolean

true if it represents a valid location - the actual meaning of the validity depends on the implementation

Exceptions
IOException:
If failed to validate the location
loadClientIdentitiesback to summary
public Iterable<KeyPair> loadClientIdentities(SessionContext session, NamedResource location, FilePasswordProvider provider) throws IOException, GeneralSecurityException
Parameters
session:SessionContext

The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool).

location:NamedResource

The identity key-pair location - the actual meaning (file, URL, etc.) depends on the implementation.

provider:FilePasswordProvider

The FilePasswordProvider to consult if the location contains an encrypted identity

Returns:Iterable<KeyPair>

The loaded KeyPair - null if location is empty and it is OK that it does not exist

Exceptions
IOException:
If failed to access / process the remote location
GeneralSecurityException:
If failed to convert the contents into a valid identity