public final class ClientIdentity
extends java.lang.Object
id_rsaSecurityUtils.getKeyPairResourceParser()| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ID_FILE_PREFIX |
static java.lang.String |
ID_FILE_SUFFIX |
static java.util.function.Function<java.lang.String,java.lang.String> |
ID_GENERATOR |
| Modifier | Constructor and Description |
|---|---|
private |
ClientIdentity() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getIdentityFileName(NamedResource r) |
static java.lang.String |
getIdentityFileName(java.lang.String type) |
static java.lang.String |
getIdentityType(java.lang.String name) |
static java.util.Map<java.lang.String,java.security.KeyPair> |
loadDefaultIdentities(boolean strict,
FilePasswordProvider provider,
java.nio.file.LinkOption... options) |
static java.util.Map<java.lang.String,java.security.KeyPair> |
loadDefaultIdentities(java.nio.file.Path dir,
boolean strict,
FilePasswordProvider provider,
java.nio.file.LinkOption... options) |
static KeyPairProvider |
loadDefaultKeyPairProvider(boolean strict,
boolean supportedOnly,
FilePasswordProvider provider,
java.nio.file.LinkOption... options) |
static KeyPairProvider |
loadDefaultKeyPairProvider(java.nio.file.Path dir,
boolean strict,
boolean supportedOnly,
FilePasswordProvider provider,
java.nio.file.LinkOption... options) |
static java.util.Map<java.lang.String,java.security.KeyPair> |
loadIdentities(SessionContext session,
java.nio.file.Path dir,
boolean strict,
java.util.Collection<java.lang.String> types,
java.util.function.Function<? super java.lang.String,java.lang.String> idGenerator,
FilePasswordProvider provider,
java.nio.file.LinkOption... options)
Scans a folder and loads all available identity files
|
static java.util.Map<java.lang.String,java.nio.file.Path> |
scanIdentitiesFolder(java.nio.file.Path dir,
boolean strict,
java.util.Collection<java.lang.String> types,
java.util.function.Function<? super java.lang.String,java.lang.String> idGenerator,
java.nio.file.LinkOption... options)
Scans a folder for possible identity files
|
public static final java.lang.String ID_FILE_PREFIX
public static final java.lang.String ID_FILE_SUFFIX
public static final java.util.function.Function<java.lang.String,java.lang.String> ID_GENERATOR
public static java.lang.String getIdentityType(java.lang.String name)
name - The file name - ignored if null/emptynull if cannot determine it - e.g.,
does not start with the ID_FILE_PREFIXpublic static java.lang.String getIdentityFileName(NamedResource r)
public static java.lang.String getIdentityFileName(java.lang.String type)
type - The identity type - e.g., rsa - ignored
if null/emptynull
if no nameID_FILE_PREFIX,
ID_FILE_SUFFIX,
IdentityUtils.getIdentityFileName(String, String, String)public static KeyPairProvider loadDefaultKeyPairProvider(boolean strict, boolean supportedOnly, FilePasswordProvider provider, java.nio.file.LinkOption... options) throws java.io.IOException, java.security.GeneralSecurityException
strict - If true then files that do not have the required
access rights are excluded from considerationsupportedOnly - If true then ignore identities that are not
supported internallyprovider - 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 LinkOptions to apply when checking
for existenceKeyPair for the identities - null if no identities
available (e.g., after filtering unsupported ones or strict permissions)java.io.IOException - If failed to access the file systemjava.security.GeneralSecurityException - If failed to load the keysPublicKeyEntry.getDefaultKeysFolderPath(),
loadDefaultIdentities(Path, boolean, FilePasswordProvider, LinkOption...)public static KeyPairProvider loadDefaultKeyPairProvider(java.nio.file.Path dir, boolean strict, boolean supportedOnly, FilePasswordProvider provider, java.nio.file.LinkOption... options) throws java.io.IOException, java.security.GeneralSecurityException
dir - The folder to scan for the built-in identitiesstrict - If true then files that do not have the required
access rights are excluded from considerationsupportedOnly - If true then ignore identities that are not
supported internallyprovider - 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 LinkOptions to apply when checking
for existenceKeyPair for the identities - null if no identities
available (e.g., after filtering unsupported ones or strict permissions)java.io.IOException - If failed to access the file systemjava.security.GeneralSecurityException - If failed to load the keysloadDefaultIdentities(Path, boolean, FilePasswordProvider, LinkOption...),
IdentityUtils.createKeyPairProvider(Map, boolean)public static java.util.Map<java.lang.String,java.security.KeyPair> loadDefaultIdentities(boolean strict,
FilePasswordProvider provider,
java.nio.file.LinkOption... options)
throws java.io.IOException,
java.security.GeneralSecurityException
strict - If true then files that do not have the required
access rights are excluded from considerationprovider - 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 LinkOptions to apply when checking
for existenceMap of the found files 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 keysPublicKeyEntry.getDefaultKeysFolderPath(),
loadDefaultIdentities(Path, boolean, FilePasswordProvider, LinkOption...)public static java.util.Map<java.lang.String,java.security.KeyPair> loadDefaultIdentities(java.nio.file.Path dir,
boolean strict,
FilePasswordProvider provider,
java.nio.file.LinkOption... options)
throws java.io.IOException,
java.security.GeneralSecurityException
dir - The folder to scan for the built-in identitiesstrict - If true then files that do not have the required
access rights are excluded from considerationprovider - 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 LinkOptions to apply when checking
for existenceMap of the found files 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 keysBuiltinIdentitiespublic static java.util.Map<java.lang.String,java.security.KeyPair> loadIdentities(SessionContext session, java.nio.file.Path dir, boolean strict, java.util.Collection<java.lang.String> types, java.util.function.Function<? super java.lang.String,java.lang.String> idGenerator, FilePasswordProvider provider, java.nio.file.LinkOption... 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).dir - The Path of the folder to scan - ignored if not existsstrict - If true then files that do not have the required
access rights are excluded from considerationtypes - The identity types - ignored if null/emptyidGenerator - A Function to derive the file name
holding the specified typeprovider - 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 LinkOptions to apply when checking
for existenceMap of the found files 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 keyspublic static java.util.Map<java.lang.String,java.nio.file.Path> scanIdentitiesFolder(java.nio.file.Path dir,
boolean strict,
java.util.Collection<java.lang.String> types,
java.util.function.Function<? super java.lang.String,java.lang.String> idGenerator,
java.nio.file.LinkOption... options)
throws java.io.IOException
dir - The Path of the folder to scan - ignored if not existsstrict - If true then files that do not have the required
access rights are excluded from considerationtypes - The identity types - ignored if null/emptyidGenerator - A Function to derive the file name
holding the specified typeoptions - The LinkOptions to apply when checking
for existenceMap of the found files where key=identity type (case
insensitive), value=the Path of the file holding the keyjava.io.IOException - If failed to access the file systemKeyUtils.validateStrictKeyFilePermissions(Path, LinkOption...)