Class MappedKeyPairProvider
- java.lang.Object
-
- org.apache.sshd.common.keyprovider.MappedKeyPairProvider
-
- All Implemented Interfaces:
KeyIdentityProvider
,KeyPairProvider
public class MappedKeyPairProvider extends Object implements KeyPairProvider
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static Function<Map<String,KeyPair>,KeyPairProvider>
MAP_TO_KEY_PAIR_PROVIDER
Transforms aMap
ofString
->KeyPair
to aKeyPairProvider
where map key is the type and value is the associatedKeyPair
-
Fields inherited from interface org.apache.sshd.common.keyprovider.KeyIdentityProvider
EMPTY_KEYS_PROVIDER
-
Fields inherited from interface org.apache.sshd.common.keyprovider.KeyPairProvider
ECDSA_SHA2_NISTP256, ECDSA_SHA2_NISTP384, ECDSA_SHA2_NISTP521, EMPTY_KEYPAIR_PROVIDER, SSH_DSS, SSH_DSS_CERT, SSH_ECDSA_SHA2_NISTP256_CERT, SSH_ECDSA_SHA2_NISTP384_CERT, SSH_ECDSA_SHA2_NISTP521_CERT, SSH_ED25519, SSH_ED25519_CERT, SSH_RSA, SSH_RSA_CERT
-
-
Constructor Summary
Constructors Constructor Description MappedKeyPairProvider(KeyPair... pairs)
MappedKeyPairProvider(Collection<? extends KeyPair> pairs)
MappedKeyPairProvider(Map<String,KeyPair> pairsMap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<String>
getKeyTypes(SessionContext session)
KeyPair
loadKey(SessionContext session, String type)
Load a key of the specified type which can be "ssh-rsa", "ssh-dss", or "ecdsa-sha2-nistp{256,384,521}".Iterable<KeyPair>
loadKeys(SessionContext session)
Load available keys.static Map<String,KeyPair>
mapUniquePairs(Collection<? extends KeyPair> pairs)
String
toString()
-
-
-
Field Detail
-
MAP_TO_KEY_PAIR_PROVIDER
public static final Function<Map<String,KeyPair>,KeyPairProvider> MAP_TO_KEY_PAIR_PROVIDER
Transforms aMap
ofString
->KeyPair
to aKeyPairProvider
where map key is the type and value is the associatedKeyPair
-
-
Method Detail
-
loadKeys
public Iterable<KeyPair> loadKeys(SessionContext session)
Description copied from interface:KeyIdentityProvider
Load available keys.- Specified by:
loadKeys
in interfaceKeyIdentityProvider
- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool or session unknown).- Returns:
- an
Iterable
instance of available keys - ignored ifnull
-
loadKey
public KeyPair loadKey(SessionContext session, String type)
Description copied from interface:KeyPairProvider
Load a key of the specified type which can be "ssh-rsa", "ssh-dss", or "ecdsa-sha2-nistp{256,384,521}". If there is no key of this type, returnnull
- Specified by:
loadKey
in interfaceKeyPairProvider
- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool).type
- the type of key to load- Returns:
- a valid key pair or
null
if this type of key is not available
-
getKeyTypes
public Iterable<String> getKeyTypes(SessionContext session)
- Specified by:
getKeyTypes
in interfaceKeyPairProvider
- Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool).- Returns:
- The available
Iterable
key types - nevernull
-
mapUniquePairs
public static Map<String,KeyPair> mapUniquePairs(Collection<? extends KeyPair> pairs)
-
-