Class IdentityUtils
java.lang.Object
org.apache.sshd.common.config.keys.IdentityUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyPairProvidercreateKeyPairProvider(Map<String, KeyPair> ids, boolean supportedOnly) static StringgetIdentityFileName(String prefix, String type, String suffix) static NavigableMap<String, KeyPair> loadIdentities(SessionContext session, Map<String, ? extends Path> paths, FilePasswordProvider provider, OpenOption... options)
-
Constructor Details
-
IdentityUtils
private IdentityUtils()
-
-
Method Details
-
getIdentityFileName
- Parameters:
prefix- The file name prefix - ignored ifnull/emptytype- The identity type - ignored ifnull/emptysuffix- The file name suffix - ignored ifnull/empty- Returns:
- The identity file name or
nullif no name
-
createKeyPairProvider
- Parameters:
ids- AMapof the loaded identities where key=the identity type, value=the matchingKeyPair- ignored ifnull/emptysupportedOnly- Iftruethen ignore identities that are not supported internally- Returns:
- A
KeyPairfor the identities -nullif no identities available (e.g., after filtering unsupported ones) - See Also:
-
loadIdentities
public static NavigableMap<String,KeyPair> loadIdentities(SessionContext session, Map<String, ? extends Path> paths, FilePasswordProvider provider, OpenOption... options) throws IOException, GeneralSecurityException- Parameters:
session- TheSessionContextfor invoking this load command - may benullif not invoked within a session context (e.g., offline tool or session unknown).paths- AMapof the identities where key=identity type (case insensitive), value=thePathof file with the identity keyprovider- AFilePasswordProvider- may benullif the loaded keys are guaranteed not to be encrypted. The argument toFilePasswordProvider#getPasswordis the path of the file whose key is to be loadedoptions- TheOpenOptions to use when reading the key data- Returns:
- A
NavigableMapof the identities where key=identity type (case insensitive), value=theKeyPairof the identity - Throws:
IOException- If failed to access the file systemGeneralSecurityException- If failed to load the keys
-