Interface KeyPairProvider
-
- All Superinterfaces:
KeyIdentityProvider
- All Known Implementing Classes:
AbstractGeneratorHostKeyProvider,AbstractKeyPairProvider,AbstractResourceKeyPairProvider,BouncyCastleGeneratorHostKeyProvider,BuiltinClientIdentitiesWatcher,ClassLoadableResourceKeyPairProvider,ClientIdentitiesWatcher,DefaultClientIdentitiesWatcher,FileKeyPairProvider,MappedKeyPairProvider,SimpleGeneratorHostKeyProvider
public interface KeyPairProvider extends KeyIdentityProvider
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
Fields Modifier and Type Field Description static StringECDSA_SHA2_NISTP256SSH identifier for EC keys in NIST curve P-256static StringECDSA_SHA2_NISTP384SSH identifier for EC keys in NIST curve P-384static StringECDSA_SHA2_NISTP521SSH identifier for EC keys in NIST curve P-521static KeyPairProviderEMPTY_KEYPAIR_PROVIDERAKeyPairProviderthat has no keysstatic StringSSH_DSSSSH identifier for DSA keysstatic StringSSH_DSS_CERTstatic StringSSH_ECDSA_SHA2_NISTP256_CERTstatic StringSSH_ECDSA_SHA2_NISTP384_CERTstatic StringSSH_ECDSA_SHA2_NISTP521_CERTstatic StringSSH_ED25519SSH identifier for ED25519 elliptic curve keysstatic StringSSH_ED25519_CERTstatic StringSSH_RSASSH identifier for RSA keysstatic StringSSH_RSA_CERTSSH identifier for openssh cert keys-
Fields inherited from interface org.apache.sshd.common.keyprovider.KeyIdentityProvider
EMPTY_KEYS_PROVIDER
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default Iterable<String>getKeyTypes(SessionContext session)default KeyPairloadKey(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}".static KeyPairProviderwrap(Iterable<KeyPair> pairs)Wrap the providedKeyPairs into aKeyPairProviderstatic KeyPairProviderwrap(KeyPair... pairs)Wrap the providedKeyPairs into aKeyPairProvider-
Methods inherited from interface org.apache.sshd.common.keyprovider.KeyIdentityProvider
loadKeys
-
-
-
-
Field Detail
-
SSH_RSA
static final String SSH_RSA
SSH identifier for RSA keys- See Also:
- Constant Field Values
-
SSH_DSS
static final String SSH_DSS
SSH identifier for DSA keys- See Also:
- Constant Field Values
-
SSH_ED25519
static final String SSH_ED25519
SSH identifier for ED25519 elliptic curve keys- See Also:
- Constant Field Values
-
ECDSA_SHA2_NISTP256
static final String ECDSA_SHA2_NISTP256
SSH identifier for EC keys in NIST curve P-256
-
ECDSA_SHA2_NISTP384
static final String ECDSA_SHA2_NISTP384
SSH identifier for EC keys in NIST curve P-384
-
ECDSA_SHA2_NISTP521
static final String ECDSA_SHA2_NISTP521
SSH identifier for EC keys in NIST curve P-521
-
SSH_RSA_CERT
static final String SSH_RSA_CERT
SSH identifier for openssh cert keys- See Also:
- Constant Field Values
-
SSH_DSS_CERT
static final String SSH_DSS_CERT
- See Also:
- Constant Field Values
-
SSH_ED25519_CERT
static final String SSH_ED25519_CERT
- See Also:
- Constant Field Values
-
SSH_ECDSA_SHA2_NISTP256_CERT
static final String SSH_ECDSA_SHA2_NISTP256_CERT
- See Also:
- Constant Field Values
-
SSH_ECDSA_SHA2_NISTP384_CERT
static final String SSH_ECDSA_SHA2_NISTP384_CERT
- See Also:
- Constant Field Values
-
SSH_ECDSA_SHA2_NISTP521_CERT
static final String SSH_ECDSA_SHA2_NISTP521_CERT
- See Also:
- Constant Field Values
-
EMPTY_KEYPAIR_PROVIDER
static final KeyPairProvider EMPTY_KEYPAIR_PROVIDER
AKeyPairProviderthat has no keys
-
-
Method Detail
-
loadKey
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, returnnull- Parameters:
session- TheSessionContextfor invoking this load command - may benullif not invoked within a session context (e.g., offline tool).type- the type of key to load- Returns:
- a valid key pair or
nullif this type of key is not available - Throws:
IOException- If failed to read/parse the keys dataGeneralSecurityException- If failed to generate the keys
-
getKeyTypes
default Iterable<String> getKeyTypes(SessionContext session) throws IOException, GeneralSecurityException
- Parameters:
session- TheSessionContextfor invoking this load command - may benullif not invoked within a session context (e.g., offline tool).- Returns:
- The available
Iterablekey types - nevernull - Throws:
IOException- If failed to read/parse the keys dataGeneralSecurityException- If failed to generate the keys
-
wrap
static KeyPairProvider wrap(KeyPair... pairs)
Wrap the providedKeyPairs into aKeyPairProvider- Parameters:
pairs- The available pairs - ignored ifnull/empty (i.e., returnsEMPTY_KEYPAIR_PROVIDER)- Returns:
- The provider wrapper
- See Also:
wrap(Iterable)
-
wrap
static KeyPairProvider wrap(Iterable<KeyPair> pairs)
Wrap the providedKeyPairs into aKeyPairProvider- Parameters:
pairs- The available pairsIterable- ignored ifnull(i.e., returnsEMPTY_KEYPAIR_PROVIDER)- Returns:
- The provider wrapper
-
-