Top Constructors Methods
org.apache.sshd.common.config.keys

public final Class IdentityUtils

extends Object
Class Inheritance
Imports
java.io.IOException, .InputStream, java.nio.file.OpenOption, .Path, java.security.GeneralSecurityException, .KeyPair, java.util.Collections, .Map, .NavigableMap, .TreeMap, org.apache.sshd.common.keyprovider.KeyPairProvider, .MappedKeyPairProvider, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.GenericUtils, .MapEntryUtils, .ValidateUtils, org.apache.sshd.common.util.io.resource.PathResource, org.apache.sshd.common.util.security.SecurityUtils

Author
Apache MINA SSHD Project

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static KeyPairProvider

Returns:

A KeyPair for the identities - null if no identities available (e.g., after filtering unsupported ones)
createKeyPairProvider
(Map<String, KeyPair>
A Map of the loaded identities where key=the identity type, value=the matching KeyPair - ignored if null/empty
ids
,
boolean
If true then ignore identities that are not supported internally
supportedOnly
)

public static String

Returns:

The identity file name or null if no name
getIdentityFileName
(String
The file name prefix - ignored if null/empty
prefix
,
String
The identity type - ignored if null/empty
type
,
String
The file name suffix - ignored if null/empty
suffix
)

public static NavigableMap<String, KeyPair>

Returns:

A NavigableMap of the identities where key=identity type (case insensitive), value=the KeyPair of the identity
loadIdentities
(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
,
Map<String, ? extends Path>
A Map of the identities where key=identity type (case insensitive), value=the Path of file with the identity key
paths
,
FilePasswordProvider
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 loaded
provider
,
OpenOption...
The OpenOptions to use when reading the key data
options
)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

IdentityUtilsback to summary
private IdentityUtils()

Method Detail

createKeyPairProviderback to summary
public static KeyPairProvider createKeyPairProvider(Map<String, KeyPair> ids, boolean supportedOnly)
Parameters
ids:Map<String, KeyPair>

A Map of the loaded identities where key=the identity type, value=the matching KeyPair - ignored if null/empty

supportedOnly:boolean

If true then ignore identities that are not supported internally

Returns:KeyPairProvider

A KeyPair for the identities - null if no identities available (e.g., after filtering unsupported ones)

See Also
BuiltinIdentities
getIdentityFileNameback to summary
public static String getIdentityFileName(String prefix, String type, String suffix)
Parameters
prefix:String

The file name prefix - ignored if null/empty

type:String

The identity type - ignored if null/empty

suffix:String

The file name suffix - ignored if null/empty

Returns:String

The identity file name or null if no name

loadIdentitiesback to summary
public static NavigableMap<String, KeyPair> loadIdentities(SessionContext session, Map<String, ? extends Path> paths, FilePasswordProvider provider, OpenOption... options) throws IOException, GeneralSecurityException
Parameters
session:SessionContext

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:Map<String, ? extends Path>

A Map of the identities where key=identity type (case insensitive), value=the Path of file with the identity key

provider:FilePasswordProvider

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 loaded

options:OpenOption[]

The OpenOptions to use when reading the key data

Returns:NavigableMap<String, KeyPair>

A NavigableMap of the identities where key=identity type (case insensitive), value=the KeyPair of the identity

Exceptions
IOException:
If failed to access the file system
GeneralSecurityException:
If failed to load the keys