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

public Interface KeyPairProvider

extends KeyIdentityProvider
Known Direct Implementers
org.apache.sshd.common.keyprovider.MappedKeyPairProvider, org.apache.sshd.common.keyprovider.AbstractKeyPairProvider
Imports
java.io.IOException, java.security.GeneralSecurityException, .KeyPair, java.util.Arrays, .Collection, .Collections, .LinkedHashSet, .Objects, java.util.stream.Collectors, org.apache.sshd.common.cipher.ECCurves, org.apache.sshd.common.config.keys.KeyUtils, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.GenericUtils, .ValidateUtils

Provider for key pairs. This provider is used on the server side to provide the host key, or on the client side to provide the user key.
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final String
ECDSA_SHA2_NISTP256

SSH identifier for EC keys in NIST curve P-256

public static final String
ECDSA_SHA2_NISTP384

SSH identifier for EC keys in NIST curve P-384

public static final String
ECDSA_SHA2_NISTP521

SSH identifier for EC keys in NIST curve P-521

public static final KeyPairProvider
public static final String
SSH_DSS

SSH identifier for DSA keys

public static final String
public static final String
public static final String
public static final String
public static final String
SSH_ED25519

SSH identifier for ED25519 elliptic curve keys

public static final String
public static final String
SSH_RSA

SSH identifier for RSA keys

public static final String
SSH_RSA_CERT

SSH identifier for openssh cert keys

Inherited from org.apache.sshd.common.keyprovider.KeyIdentityProvider:
EMPTY_KEYS_PROVIDER

Method Summary

Modifier and TypeMethod and Description
public default Iterable<String>

Returns:

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

public default KeyPair

Returns:

a valid key pair or null if this type of key is not available
loadKey
(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool).
session
,
String
the type of key to load
type
)

Load a key of the specified type which can be "ssh-rsa", "ssh-dss", or "ecdsa-sha2-nistp{256,384,521}".

public static KeyPairProvider

Returns:

The provider wrapper
wrap
(KeyPair...
The available pairs - ignored if null/empty (i.e., returns EMPTY_KEYPAIR_PROVIDER)
pairs
)

Wrap the provided KeyPairs into a KeyPairProvider

public static KeyPairProvider

Returns:

The provider wrapper
wrap
(Iterable<KeyPair>
The available pairs Iterable - ignored if null (i.e., returns EMPTY_KEYPAIR_PROVIDER)
pairs
)

Wrap the provided KeyPairs into a KeyPairProvider

Inherited from org.apache.sshd.common.keyprovider.KeyIdentityProvider:
exhaustCurrentIdentitiesisEmptyiterableOfloadKeysmultiProvidermultiProviderresolveKeyIdentityProviderwrapKeyPairswrapKeyPairs

Field Detail

ECDSA_SHA2_NISTP256back to summary
public static final String ECDSA_SHA2_NISTP256

SSH identifier for EC keys in NIST curve P-256

ECDSA_SHA2_NISTP384back to summary
public static final String ECDSA_SHA2_NISTP384

SSH identifier for EC keys in NIST curve P-384

ECDSA_SHA2_NISTP521back to summary
public static final String ECDSA_SHA2_NISTP521

SSH identifier for EC keys in NIST curve P-521

EMPTY_KEYPAIR_PROVIDERback to summary
public static final KeyPairProvider EMPTY_KEYPAIR_PROVIDER

A KeyPairProvider that has no keys

SSH_DSSback to summary
public static final String SSH_DSS

SSH identifier for DSA keys

SSH_DSS_CERTback to summary
public static final String SSH_DSS_CERT
SSH_ECDSA_SHA2_NISTP256_CERTback to summary
public static final String SSH_ECDSA_SHA2_NISTP256_CERT
SSH_ECDSA_SHA2_NISTP384_CERTback to summary
public static final String SSH_ECDSA_SHA2_NISTP384_CERT
SSH_ECDSA_SHA2_NISTP521_CERTback to summary
public static final String SSH_ECDSA_SHA2_NISTP521_CERT
SSH_ED25519back to summary
public static final String SSH_ED25519

SSH identifier for ED25519 elliptic curve keys

SSH_ED25519_CERTback to summary
public static final String SSH_ED25519_CERT
SSH_RSAback to summary
public static final String SSH_RSA

SSH identifier for RSA keys

SSH_RSA_CERTback to summary
public static final String SSH_RSA_CERT

SSH identifier for openssh cert keys

Method Detail

getKeyTypesback to summary
public default Iterable<String> getKeyTypes(SessionContext session) 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).

Returns:Iterable<String>

The available Iterable key types - never null

Exceptions
IOException:
If failed to read/parse the keys data
GeneralSecurityException:
If failed to generate the keys
loadKeyback to summary
public default KeyPair loadKey(SessionContext session, String type) throws IOException, GeneralSecurityException

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, return null

Parameters
session:SessionContext

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

type:String

the type of key to load

Returns:KeyPair

a valid key pair or null if this type of key is not available

Exceptions
IOException:
If failed to read/parse the keys data
GeneralSecurityException:
If failed to generate the keys
wrapback to summary
public static KeyPairProvider wrap(KeyPair... pairs)

Wrap the provided KeyPairs into a KeyPairProvider

Parameters
pairs:KeyPair[]

The available pairs - ignored if null/empty (i.e., returns EMPTY_KEYPAIR_PROVIDER)

Returns:KeyPairProvider

The provider wrapper

See Also
wrap(Iterable)
wrapback to summary
public static KeyPairProvider wrap(Iterable<KeyPair> pairs)

Wrap the provided KeyPairs into a KeyPairProvider

Parameters
pairs:Iterable<KeyPair>

The available pairs Iterable - ignored if null (i.e., returns EMPTY_KEYPAIR_PROVIDER)

Returns:KeyPairProvider

The provider wrapper