public final class IdentityUtils
extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
IdentityUtils() |
Modifier and Type | Method and Description |
---|---|
static KeyPairProvider |
createKeyPairProvider(java.util.Map<java.lang.String,java.security.KeyPair> ids,
boolean supportedOnly) |
static java.lang.String |
getIdentityFileName(java.lang.String prefix,
java.lang.String type,
java.lang.String suffix) |
static java.util.NavigableMap<java.lang.String,java.security.KeyPair> |
loadIdentities(SessionContext session,
java.util.Map<java.lang.String,? extends java.nio.file.Path> paths,
FilePasswordProvider provider,
java.nio.file.OpenOption... options) |
public static java.lang.String getIdentityFileName(java.lang.String prefix, java.lang.String type, java.lang.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(java.util.Map<java.lang.String,java.security.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 java.util.NavigableMap<java.lang.String,java.security.KeyPair> loadIdentities(SessionContext session, java.util.Map<java.lang.String,? extends java.nio.file.Path> paths, FilePasswordProvider provider, java.nio.file.OpenOption... options) throws java.io.IOException, java.security.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 identityjava.io.IOException
- If failed to access the file systemjava.security.GeneralSecurityException
- If failed to load the keys