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 Map<String,KeyPair> |
loadIdentities(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 Map<String,KeyPair> loadIdentities(Map<String,? extends Path> paths, FilePasswordProvider provider, OpenOption... options) throws IOException, GeneralSecurityException
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(String)
is the path of the
file whose key is to be loadedoptions
- The OpenOption
s to use when reading the key dataMap
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 keysSecurityUtils.loadKeyPairIdentity(String, InputStream, FilePasswordProvider)
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.