Top Fields Methods
org.apache.sshd.common.keyprovider

public Interface KeyIdentityProvider

Known Direct Subinterfaces
org.apache.sshd.common.keyprovider.KeyPairProvider, org.apache.sshd.client.auth.AuthenticationIdentitiesProvider
Known Direct Implementers
org.apache.sshd.common.keyprovider.MultiKeyIdentityProvider, org.apache.sshd.client.config.keys.LazyClientKeyIdentityProvider
Annotations
@FunctionalInterface
Imports
java.io.IOException, java.security.GeneralSecurityException, .KeyPair, java.util.Collection, .Collections, .Iterator, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.GenericUtils, org.apache.sshd.common.util.functors.UnaryEquator

Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final KeyIdentityProvider
EMPTY_KEYS_PROVIDER

An "empty" implementation of KeyIdentityProvider that returns an empty group of key pairs

Method Summary

Modifier and TypeMethod and Description
public static KeyPair

Returns:

The first non-null key pair found in the iterator - null if all elements exhausted without such an entry
exhaustCurrentIdentities
(Iterator<KeyPair>
The Iterator - ignored if null or no next element available
ids
)

Attempts to find the first non-null KeyPair

public static boolean

Returns:

true if instance is null or the EMPTY_KEYS_PROVIDER
isEmpty
(KeyIdentityProvider
The KeyIdentityProvider instance to verify
provider
)

public static Iterable<KeyPair>

Returns:

The wrapping iterable
iterableOf
(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
,
Collection<? extends KeyIdentityProvider>
The group of providers - ignored if null/empty (i.e., returns an empty iterable instance)
providers
)

Wraps a group of KeyIdentityProvider into an Iterable of KeyPairs

public Iterable<KeyPair>

Returns:

an Iterable instance of available keys - ignored if null
loadKeys
(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
)

Load available keys.

public static KeyIdentityProvider

Returns:

The wrapping provider
multiProvider
(KeyIdentityProvider...
The providers - ignored if null/empty (i.e., returns EMPTY_KEYS_PROVIDER)
providers
)

Wraps a group of KeyIdentityProvider into a single one

public static KeyIdentityProvider

Returns:

The wrapping provider
multiProvider
(Collection<? extends KeyIdentityProvider>
The providers - ignored if null/empty (i.e., returns EMPTY_KEYS_PROVIDER)
providers
)

Wraps a group of KeyIdentityProvider into a single one

public static KeyIdentityProvider

Returns:

The resolved provider
resolveKeyIdentityProvider
(KeyIdentityProvider
The registered key pair identities
identities
,
KeyIdentityProvider
The extra available key pairs
keys
)

Creates a "unified" KeyIdentityProvider out of 2 possible ones as follows:

  • If both are null then return null.
  • If either one is null/empty then use the non-null one.
  • If both are the same instance then use the instance.
  • Otherwise, returns a wrapper that groups both providers.
public static KeyIdentityProvider

Returns:

The provider wrapper
wrapKeyPairs
(KeyPair...
The key pairs - ignored if null/empty (i.e., returns EMPTY_KEYS_PROVIDER).
pairs
)

Wraps a group of KeyPairs into a KeyIdentityProvider

public static KeyIdentityProvider

Returns:

The provider wrapper
wrapKeyPairs
(Iterable<KeyPair>
The key pairs Iterable - ignored if null (i.e., returns EMPTY_KEYS_PROVIDER).
pairs
)

Wraps a group of KeyPairs into a KeyIdentityProvider

Field Detail

EMPTY_KEYS_PROVIDERback to summary
public static final KeyIdentityProvider EMPTY_KEYS_PROVIDER

An "empty" implementation of KeyIdentityProvider that returns an empty group of key pairs

Method Detail

exhaustCurrentIdentitiesback to summary
public static KeyPair exhaustCurrentIdentities(Iterator<KeyPair> ids)

Attempts to find the first non-null KeyPair

Parameters
ids:Iterator<KeyPair>

The Iterator - ignored if null or no next element available

Returns:KeyPair

The first non-null key pair found in the iterator - null if all elements exhausted without such an entry

isEmptyback to summary
public static boolean isEmpty(KeyIdentityProvider provider)
Parameters
provider:KeyIdentityProvider

The KeyIdentityProvider instance to verify

Returns:boolean

true if instance is null or the EMPTY_KEYS_PROVIDER

iterableOfback to summary
public static Iterable<KeyPair> iterableOf(SessionContext session, Collection<? extends KeyIdentityProvider> providers)

Wraps a group of KeyIdentityProvider into an Iterable of KeyPairs

Parameters
session:SessionContext

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

providers:Collection<? extends KeyIdentityProvider>

The group of providers - ignored if null/empty (i.e., returns an empty iterable instance)

Returns:Iterable<KeyPair>

The wrapping iterable

loadKeysback to summary
public Iterable<KeyPair> loadKeys(SessionContext session) throws IOException, GeneralSecurityException

Load available keys.

Parameters
session:SessionContext

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

Returns:Iterable<KeyPair>

an Iterable instance of available keys - ignored if null

Exceptions
IOException:
If failed to read/parse the keys data
GeneralSecurityException:
If failed to generate the keys
multiProviderback to summary
public static KeyIdentityProvider multiProvider(KeyIdentityProvider... providers)

Wraps a group of KeyIdentityProvider into a single one

Parameters
providers:KeyIdentityProvider[]

The providers - ignored if null/empty (i.e., returns EMPTY_KEYS_PROVIDER)

Returns:KeyIdentityProvider

The wrapping provider

See Also
multiProvider(Collection)
multiProviderback to summary
public static KeyIdentityProvider multiProvider(Collection<? extends KeyIdentityProvider> providers)

Wraps a group of KeyIdentityProvider into a single one

Parameters
providers:Collection<? extends KeyIdentityProvider>

The providers - ignored if null/empty (i.e., returns EMPTY_KEYS_PROVIDER)

Returns:KeyIdentityProvider

The wrapping provider

See Also
MultiKeyIdentityProvider
resolveKeyIdentityProviderback to summary
public static KeyIdentityProvider resolveKeyIdentityProvider(KeyIdentityProvider identities, KeyIdentityProvider keys)

Creates a "unified" KeyIdentityProvider out of 2 possible ones as follows:

  • If both are null then return null.
  • If either one is null/empty then use the non-null one.
  • If both are the same instance then use the instance.
  • Otherwise, returns a wrapper that groups both providers.
Parameters
identities:KeyIdentityProvider

The registered key pair identities

keys:KeyIdentityProvider

The extra available key pairs

Returns:KeyIdentityProvider

The resolved provider

See Also
multiProvider(KeyIdentityProvider...)
wrapKeyPairsback to summary
public static KeyIdentityProvider wrapKeyPairs(KeyPair... pairs)

Wraps a group of KeyPairs into a KeyIdentityProvider

Parameters
pairs:KeyPair[]

The key pairs - ignored if null/empty (i.e., returns EMPTY_KEYS_PROVIDER).

Returns:KeyIdentityProvider

The provider wrapper

wrapKeyPairsback to summary
public static KeyIdentityProvider wrapKeyPairs(Iterable<KeyPair> pairs)

Wraps a group of KeyPairs into a KeyIdentityProvider

Parameters
pairs:Iterable<KeyPair>

The key pairs Iterable - ignored if null (i.e., returns EMPTY_KEYS_PROVIDER).

Returns:KeyIdentityProvider

The provider wrapper