public final class ClientIdentity extends Object
id_rsaSecurityUtils.getKeyPairResourceParser()| Modifier and Type | Field and Description |
|---|---|
static String |
ID_FILE_PREFIX |
static String |
ID_FILE_SUFFIX |
static Function<String,String> |
ID_GENERATOR |
| Modifier and Type | Method and Description |
|---|---|
static String |
getIdentityFileName(NamedResource r) |
static String |
getIdentityFileName(String type) |
static String |
getIdentityType(String name) |
static Map<String,KeyPair> |
loadDefaultIdentities(boolean strict,
FilePasswordProvider provider,
LinkOption... options) |
static Map<String,KeyPair> |
loadDefaultIdentities(Path dir,
boolean strict,
FilePasswordProvider provider,
LinkOption... options) |
static KeyPairProvider |
loadDefaultKeyPairProvider(boolean strict,
boolean supportedOnly,
FilePasswordProvider provider,
LinkOption... options) |
static KeyPairProvider |
loadDefaultKeyPairProvider(Path dir,
boolean strict,
boolean supportedOnly,
FilePasswordProvider provider,
LinkOption... options) |
static Map<String,KeyPair> |
loadIdentities(Path dir,
boolean strict,
Collection<String> types,
Function<String,String> idGenerator,
FilePasswordProvider provider,
LinkOption... options)
Scans a folder and loads all available identity files
|
static Map<String,Path> |
scanIdentitiesFolder(Path dir,
boolean strict,
Collection<String> types,
Function<String,String> idGenerator,
LinkOption... options)
Scans a folder for possible identity files
|
static <C extends SshClient> |
setKeyPairProvider(C client,
boolean strict,
boolean supportedOnly,
FilePasswordProvider provider,
LinkOption... options) |
static <C extends SshClient> |
setKeyPairProvider(C client,
Path dir,
boolean strict,
boolean supportedOnly,
FilePasswordProvider provider,
LinkOption... options) |
public static final String ID_FILE_PREFIX
public static final String ID_FILE_SUFFIX
public static String getIdentityType(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 String getIdentityFileName(NamedResource r)
public static String getIdentityFileName(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 <C extends SshClient> C setKeyPairProvider(C client, boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption... options) throws IOException, GeneralSecurityException
C - The generic client classclient - The SshClient to updatedstrict - 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(String) is the path of the
file whose key is to be loadedoptions - The LinkOptions to apply when checking
for existencenull
KeyPairProvider was generatedIOException - If failed to access the file systemGeneralSecurityException - If failed to load the keyssetKeyPairProvider(SshClient, Path, boolean, boolean, FilePasswordProvider, LinkOption...)public static <C extends SshClient> C setKeyPairProvider(C client, Path dir, boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption... options) throws IOException, GeneralSecurityException
C - The generic client classclient - The SshClient to updateddir - 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(String) is the path of the
file whose key is to be loadedoptions - The LinkOptions to apply when checking
for existencenull
KeyPairProvider was generatedIOException - If failed to access the file systemGeneralSecurityException - If failed to load the keysloadDefaultKeyPairProvider(Path, boolean, boolean, FilePasswordProvider, LinkOption...)public static KeyPairProvider loadDefaultKeyPairProvider(boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption... options) throws IOException, 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(String) 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)IOException - If failed to access the file systemGeneralSecurityException - If failed to load the keysPublicKeyEntry.getDefaultKeysFolderPath(),
loadDefaultIdentities(Path, boolean, FilePasswordProvider, LinkOption...)public static KeyPairProvider loadDefaultKeyPairProvider(Path dir, boolean strict, boolean supportedOnly, FilePasswordProvider provider, LinkOption... options) throws IOException, 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(String) 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)IOException - If failed to access the file systemGeneralSecurityException - If failed to load the keysloadDefaultIdentities(Path, boolean, FilePasswordProvider, LinkOption...),
IdentityUtils.createKeyPairProvider(Map, boolean)public static Map<String,KeyPair> loadDefaultIdentities(boolean strict, FilePasswordProvider provider, LinkOption... options) throws IOException, 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(String) 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 identityIOException - If failed to access the file systemGeneralSecurityException - If failed to load the keysPublicKeyEntry.getDefaultKeysFolderPath(),
loadDefaultIdentities(Path, boolean, FilePasswordProvider, LinkOption...)public static Map<String,KeyPair> loadDefaultIdentities(Path dir, boolean strict, FilePasswordProvider provider, LinkOption... options) throws IOException, 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(String) 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 identityIOException - If failed to access the file systemGeneralSecurityException - If failed to load the keysloadIdentities(Path, boolean, Collection, Function, FilePasswordProvider, LinkOption...),
BuiltinIdentitiespublic static Map<String,KeyPair> loadIdentities(Path dir, boolean strict, Collection<String> types, Function<String,String> idGenerator, FilePasswordProvider provider, LinkOption... options) throws IOException, GeneralSecurityException
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(String) 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 identityIOException - If failed to access the file systemGeneralSecurityException - If failed to load the keysscanIdentitiesFolder(Path, boolean, Collection, Function, LinkOption...),
IdentityUtils.loadIdentities(Map, FilePasswordProvider, java.nio.file.OpenOption...)public static Map<String,Path> scanIdentitiesFolder(Path dir, boolean strict, Collection<String> types, Function<String,String> idGenerator, LinkOption... options) throws 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 keyIOException - If failed to access the file systemKeyUtils.validateStrictKeyFilePermissions(Path, LinkOption...)Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.