public class MappedKeyPairProvider extends java.lang.Object implements KeyPairProvider
Map
of String
->KeyPair
where the map key is the type and value is the associated
KeyPair
Modifier and Type | Field and Description |
---|---|
static java.util.function.Function<java.util.Map<java.lang.String,java.security.KeyPair>,KeyPairProvider> |
MAP_TO_KEY_PAIR_PROVIDER
Transforms a
Map of String ->KeyPair to a KeyPairProvider where map key is the
type and value is the associated KeyPair |
private java.util.Map<java.lang.String,java.security.KeyPair> |
pairsMap |
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
EMPTY_KEYS_PROVIDER
Constructor and Description |
---|
MappedKeyPairProvider(java.util.Collection<java.security.KeyPair> pairs) |
MappedKeyPairProvider(java.security.KeyPair... pairs) |
MappedKeyPairProvider(java.util.Map<java.lang.String,java.security.KeyPair> pairsMap) |
Modifier and Type | Method and Description |
---|---|
java.lang.Iterable<java.lang.String> |
getKeyTypes(SessionContext session) |
java.security.KeyPair |
loadKey(SessionContext session,
java.lang.String type)
Load a key of the specified type which can be "ssh-rsa", "ssh-dss", or
"ecdsa-sha2-nistp{256,384,521}".
|
java.lang.Iterable<java.security.KeyPair> |
loadKeys(SessionContext session)
Load available keys.
|
static java.util.Map<java.lang.String,java.security.KeyPair> |
mapUniquePairs(java.util.Collection<java.security.KeyPair> pairs) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
wrap, wrap
exhaustCurrentIdentities, isEmpty, iterableOf, multiProvider, multiProvider, resolveKeyIdentityProvider, wrapKeyPairs, wrapKeyPairs
public static final java.util.function.Function<java.util.Map<java.lang.String,java.security.KeyPair>,KeyPairProvider> MAP_TO_KEY_PAIR_PROVIDER
Map
of String
->KeyPair
to a KeyPairProvider
where map key is the
type and value is the associated KeyPair
private final java.util.Map<java.lang.String,java.security.KeyPair> pairsMap
public MappedKeyPairProvider(java.security.KeyPair... pairs)
public MappedKeyPairProvider(java.util.Collection<java.security.KeyPair> pairs)
public MappedKeyPairProvider(java.util.Map<java.lang.String,java.security.KeyPair> pairsMap)
public java.lang.Iterable<java.security.KeyPair> loadKeys(SessionContext session)
KeyIdentityProvider
loadKeys
in interface KeyIdentityProvider
session
- The SessionContext
for invoking this load command - may be null
if not invoked within a session context (e.g., offline tool or session unknown).Iterable
instance of available keys - ignored if null
public java.security.KeyPair loadKey(SessionContext session, java.lang.String type)
KeyPairProvider
null
loadKey
in interface KeyPairProvider
session
- The SessionContext
for invoking this load command - may be null
if not invoked within a session context (e.g., offline tool).type
- the type of key to loadnull
if this type of key is not availablepublic java.lang.Iterable<java.lang.String> getKeyTypes(SessionContext session)
getKeyTypes
in interface KeyPairProvider
session
- The SessionContext
for invoking this load command - may be null
if not invoked within a session context (e.g., offline tool).Iterable
key types - never null
public java.lang.String toString()
toString
in class java.lang.Object
public static java.util.Map<java.lang.String,java.security.KeyPair> mapUniquePairs(java.util.Collection<java.security.KeyPair> pairs)