public final class IdentityUtils extends Object
Modifier and Type | Method and Description |
---|---|
static KeyPairProvider |
createKeyPairProvider(Map<String,KeyPair> ids,
boolean supportedOnly) |
static String |
getIdentityFileName(String prefix,
String type,
String suffix) |
static Path |
getUserHomeFolder() |
static NavigableMap<String,KeyPair> |
loadIdentities(SessionContext session,
Map<String,? extends Path> paths,
FilePasswordProvider provider,
OpenOption... options) |
public static Path getUserHomeFolder()
Path
to the currently running user homepublic static String getIdentityFileName(String prefix, String type, String suffix)
prefix
- The file name prefix - ignored if null
/emptytype
- The identity type - ignored if null
/emptysuffix
- The file name suffix - ignored if null
/emptynull
if no namepublic static KeyPairProvider createKeyPairProvider(Map<String,KeyPair> ids, boolean supportedOnly)
ids
- A Map
of the loaded identities where key=the identity type, value=the matching
KeyPair
- ignored if null
/emptysupportedOnly
- If true
then ignore identities that are not supported internallyKeyPair
for the identities - null
if no identities available (e.g., after
filtering unsupported ones)BuiltinIdentities
public static NavigableMap<String,KeyPair> loadIdentities(SessionContext session, Map<String,? extends Path> paths, FilePasswordProvider provider, OpenOption... options) throws IOException, GeneralSecurityException
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).paths
- A Map
of the identities where key=identity type (case
insensitive), value=the Path
of file with the identity keyprovider
- A FilePasswordProvider
- may be null
if the loaded keys are
guaranteed not to be encrypted. The argument to
FilePasswordProvider#getPassword
is the path of the file whose key is to
be loadedoptions
- The OpenOption
s to use when reading the key dataNavigableMap
of the identities where key=identity type (case
insensitive), value=the KeyPair
of the identityIOException
- If failed to access the file systemGeneralSecurityException
- If failed to load the keysCopyright © 2018–2021 The Apache Software Foundation. All rights reserved.