public final class ServerIdentity extends Object
/etc/ssh/ssh_host_rsa_key
SecurityUtils.isBouncyCastleRegistered()
Modifier and Type | Field and Description |
---|---|
static String |
HOST_KEY_CONFIG_PROP
The server's keys configuration multi-value
|
static String |
ID_FILE_PREFIX |
static String |
ID_FILE_SUFFIX |
static Transformer<String,String> |
ID_GENERATOR |
Modifier and Type | Method and Description |
---|---|
static Map<String,Path> |
findIdentities(Properties props,
LinkOption... options) |
static String |
getIdentityFileName(NamedResource r) |
static String |
getIdentityFileName(String type) |
static String |
getIdentityType(String name) |
static Map<String,KeyPair> |
loadIdentities(Properties props,
LinkOption... options) |
static KeyPairProvider |
loadKeyPairProvider(Properties props,
boolean supportedOnly,
LinkOption... options) |
static <S extends SshServer> |
setKeyPairProvider(S server,
Properties props,
boolean supportedOnly)
Sets the server's
KeyPairProvider with the loaded identities - if any |
public static final String ID_FILE_PREFIX
public static final String ID_FILE_SUFFIX
public static final String HOST_KEY_CONFIG_PROP
public static final Transformer<String,String> ID_GENERATOR
public static <S extends SshServer> S setKeyPairProvider(S server, Properties props, boolean supportedOnly) throws IOException, GeneralSecurityException
KeyPairProvider
with the loaded identities - if anyS
- The generic server typeserver
- The SshServer
to configureprops
- The Properties
holding the server's configuration - ignored
if null
/emptysupportedOnly
- If true
then ignore identities that are not
supported internallyIOException
- If failed to access the file systemGeneralSecurityException
- If failed to load the keysloadKeyPairProvider(Properties, boolean, LinkOption...)
public static KeyPairProvider loadKeyPairProvider(Properties props, boolean supportedOnly, LinkOption... options) throws IOException, GeneralSecurityException
props
- The Properties
holding the server's configuration - ignored
if null
/emptysupportedOnly
- If true
then ignore identities that are not
supported internallyoptions
- The LinkOption
s to use when checking files existenceKeyPair
for the identities - null
if no identities
available (e.g., after filtering unsupported ones)IOException
- If failed to access the file systemGeneralSecurityException
- If failed to load the keysloadIdentities(Properties, LinkOption...)
,
IdentityUtils.createKeyPairProvider(Map, boolean)
public static Map<String,KeyPair> loadIdentities(Properties props, LinkOption... options) throws IOException, GeneralSecurityException
props
- The Properties
holding the server's configuration - ignored
if null
/emptyoptions
- The LinkOption
s to use when checking files existenceMap
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 keysfindIdentities(Properties, LinkOption...)
,
IdentityUtils.loadIdentities(Map, org.apache.sshd.common.config.keys.FilePasswordProvider, java.nio.file.OpenOption...)
public static Map<String,Path> findIdentities(Properties props, LinkOption... options) throws IOException
props
- The Properties
holding the server's configuration - ignored
if null
/emptyoptions
- The LinkOption
s to use when checking files existenceMap
of the found identities where key=the identity type
(case insensitive) and value=the Path
of the file holding
the specific type keyIOException
- If failed to access the file systemgetIdentityType(String)
,
HOST_KEY_CONFIG_PROP
,
SshConfigFileReader.readConfigFile(File)
public static String getIdentityType(String name)
name
- The file name - ignored if null
/emptynull
if cannot determine it - e.g.,
does not start/end with the ID_FILE_PREFIX
/ID_FILE_SUFFIX
public 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)
Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.