public final class ServerIdentity
extends java.lang.Object
/etc/ssh/ssh_host_rsa_keySecurityUtils.getKeyPairResourceParser()| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
HOST_KEY_CONFIG_PROP
The server's keys configuration multi-value
|
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 |
ServerIdentity() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Map<java.lang.String,java.nio.file.Path> |
findIdentities(java.util.Properties props,
java.nio.file.LinkOption... options) |
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> |
loadIdentities(java.util.Properties props,
java.nio.file.LinkOption... options) |
static KeyPairProvider |
loadKeyPairProvider(java.util.Properties props,
boolean supportedOnly,
java.nio.file.LinkOption... options) |
static <S extends SshServer> |
setKeyPairProvider(S server,
java.util.Properties props,
boolean supportedOnly)
Sets the server's
KeyPairProvider with the loaded identities - if any |
public static final java.lang.String ID_FILE_PREFIX
public static final java.lang.String ID_FILE_SUFFIX
public static final java.lang.String HOST_KEY_CONFIG_PROP
public static final java.util.function.Function<java.lang.String,java.lang.String> ID_GENERATOR
public static <S extends SshServer> S setKeyPairProvider(S server, java.util.Properties props, boolean supportedOnly) throws java.io.IOException, java.security.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 internallyjava.io.IOException - If failed to access the file systemjava.security.GeneralSecurityException - If failed to load the keysloadKeyPairProvider(Properties, boolean, LinkOption...)public static KeyPairProvider loadKeyPairProvider(java.util.Properties props, boolean supportedOnly, java.nio.file.LinkOption... options) throws java.io.IOException, java.security.GeneralSecurityException
props - The Properties holding the server's configuration - ignored
if null/emptysupportedOnly - If true then ignore identities that are not
supported internallyoptions - The LinkOptions to use when checking files existenceKeyPair for the identities - null if no identities
available (e.g., after filtering unsupported ones)java.io.IOException - If failed to access the file systemjava.security.GeneralSecurityException - If failed to load the keysloadIdentities(Properties, LinkOption...),
IdentityUtils.createKeyPairProvider(Map, boolean)public static java.util.Map<java.lang.String,java.security.KeyPair> loadIdentities(java.util.Properties props,
java.nio.file.LinkOption... options)
throws java.io.IOException,
java.security.GeneralSecurityException
props - The Properties holding the server's configuration - ignored
if null/emptyoptions - The LinkOptions to use when checking files existenceMap 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 keysfindIdentities(Properties, LinkOption...)public static java.util.Map<java.lang.String,java.nio.file.Path> findIdentities(java.util.Properties props,
java.nio.file.LinkOption... options)
throws java.io.IOException
props - The Properties holding the server's configuration - ignored
if null/emptyoptions - The LinkOptions 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 keyjava.io.IOException - If failed to access the file systemgetIdentityType(String),
HOST_KEY_CONFIG_PROP,
ConfigFileReaderSupport.readConfigFile(Path, java.nio.file.OpenOption...)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/end with the ID_FILE_PREFIX/ID_FILE_SUFFIXpublic 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)