Interface KeyPairProvider
- All Superinterfaces:
KeyIdentityProvider
- All Known Implementing Classes:
AbstractGeneratorHostKeyProvider,AbstractKeyPairProvider,AbstractResourceKeyPairProvider,BouncyCastleGeneratorHostKeyProvider,BuiltinClientIdentitiesWatcher,ClassLoadableResourceKeyPairProvider,ClientIdentitiesWatcher,DefaultClientIdentitiesWatcher,FileKeyPairProvider,MappedKeyPairProvider,SimpleGeneratorHostKeyProvider
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSSH identifier for EC keys in NIST curve P-256static final StringSSH identifier for EC keys in NIST curve P-384static final StringSSH identifier for EC keys in NIST curve P-521static final KeyPairProviderAKeyPairProviderthat has no keysstatic final StringSSH identifier for DSA keysstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringSSH identifier for ED25519 elliptic curve keysstatic final Stringstatic final StringSSH identifier for RSA keysstatic final StringSSH identifier for openssh cert keysFields inherited from interface org.apache.sshd.common.keyprovider.KeyIdentityProvider
EMPTY_KEYS_PROVIDER -
Method Summary
Modifier and TypeMethodDescriptiongetKeyTypes(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 the providedKeyPairs into aKeyPairProviderstatic KeyPairProviderWrap the providedKeyPairs into aKeyPairProviderMethods inherited from interface org.apache.sshd.common.keyprovider.KeyIdentityProvider
loadKeys
-
Field Details
-
SSH_RSA
SSH identifier for RSA keys- See Also:
-
SSH_DSS
SSH identifier for DSA keys- See Also:
-
SSH_ED25519
SSH identifier for ED25519 elliptic curve keys- See Also:
-
ECDSA_SHA2_NISTP256
SSH identifier for EC keys in NIST curve P-256 -
ECDSA_SHA2_NISTP384
SSH identifier for EC keys in NIST curve P-384 -
ECDSA_SHA2_NISTP521
SSH identifier for EC keys in NIST curve P-521 -
SSH_RSA_CERT
SSH identifier for openssh cert keys- See Also:
-
SSH_DSS_CERT
- See Also:
-
SSH_ED25519_CERT
- See Also:
-
SSH_ECDSA_SHA2_NISTP256_CERT
- See Also:
-
SSH_ECDSA_SHA2_NISTP384_CERT
- See Also:
-
SSH_ECDSA_SHA2_NISTP521_CERT
- See Also:
-
EMPTY_KEYPAIR_PROVIDER
AKeyPairProviderthat has no keys
-
-
Method Details
-
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
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
Wrap the providedKeyPairs into aKeyPairProvider- Parameters:
pairs- The available pairsIterable- ignored ifnull(i.e., returnsEMPTY_KEYPAIR_PROVIDER)- Returns:
- The provider wrapper
-