Class ServerIdentity
java.lang.Object
org.apache.sshd.server.config.keys.ServerIdentity
Loads server identity key files - e.g.,
/etc/ssh/ssh_host_rsa_key
- Author:
- Apache MINA SSHD Project
- See Also:
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionfindCertificates
(Properties props, LinkOption... options) findIdentities
(Properties props, LinkOption... options) static String
getIdentityFileName
(String type) static String
static String
getIdentityType
(String name) loadIdentities
(Properties props, LinkOption... options) static KeyPairProvider
loadKeyPairProvider
(Properties props, boolean supportedOnly, LinkOption... options) static <S extends SshServer>
SsetKeyPairProvider
(S server, Properties props, boolean supportedOnly) Sets the server'sKeyPairProvider
with the loaded identities - if any
-
Field Details
-
ID_FILE_PREFIX
- See Also:
-
ID_FILE_SUFFIX
- See Also:
-
HOST_KEY_CONFIG_PROP
The server's keys configuration multi-value- See Also:
-
HOST_CERT_CONFIG_PROP
- See Also:
-
ID_GENERATOR
-
-
Method Details
-
setKeyPairProvider
public static <S extends SshServer> S setKeyPairProvider(S server, Properties props, boolean supportedOnly) throws IOException, GeneralSecurityException Sets the server'sKeyPairProvider
with the loaded identities - if any- Type Parameters:
S
- The generic server type- Parameters:
server
- TheSshServer
to configureprops
- TheProperties
holding the server's configuration - ignored ifnull
/emptysupportedOnly
- Iftrue
then ignore identities that are not supported internally- Returns:
- The updated server
- Throws:
IOException
- If failed to access the file systemGeneralSecurityException
- If failed to load the keys- See Also:
-
loadKeyPairProvider
public static KeyPairProvider loadKeyPairProvider(Properties props, boolean supportedOnly, LinkOption... options) throws IOException, GeneralSecurityException - Parameters:
props
- TheProperties
holding the server's configuration - ignored ifnull
/emptysupportedOnly
- Iftrue
then ignore identities that are not supported internallyoptions
- TheLinkOption
s to use when checking files existence- Returns:
- A
KeyPair
for the identities -null
if no identities available (e.g., after filtering unsupported ones) - Throws:
IOException
- If failed to access the file systemGeneralSecurityException
- If failed to load the keys- See Also:
-
loadIdentities
public static Map<String,KeyPair> loadIdentities(Properties props, LinkOption... options) throws IOException, GeneralSecurityException - Parameters:
props
- TheProperties
holding the server's configuration - ignored ifnull
/emptyoptions
- TheLinkOption
s to use when checking files existence- Returns:
- A
Map
of the identities where key=identity type (case insensitive), value=theKeyPair
of the identity - Throws:
IOException
- If failed to access the file systemGeneralSecurityException
- If failed to load the keys- See Also:
-
findIdentities
public static Map<String,Path> findIdentities(Properties props, LinkOption... options) throws IOException - Parameters:
props
- TheProperties
holding the server's configuration - ignored ifnull
/emptyoptions
- TheLinkOption
s to use when checking files existence- Returns:
- A
Map
of the found identities where key=the identity type (case insensitive) and value=thePath
of the file holding the specific type key - Throws:
IOException
- If failed to access the file system- See Also:
-
findCertificates
public static Map<String,Path> findCertificates(Properties props, LinkOption... options) throws IOException - Parameters:
props
- TheProperties
holding the server's configuration - ignored ifnull
/emptyoptions
- TheLinkOption
s to use when checking files existence- Returns:
- A
Map
of the found certificates where key=the identity type (case insensitive) and value=thePath
of the file holding the specific type key - Throws:
IOException
- If failed to access the file system- See Also:
-
getIdentityType
- Parameters:
name
- The file name - ignored ifnull
/empty- Returns:
- The identity type -
null
if cannot determine it - e.g., does not start/end with theID_FILE_PREFIX
/ID_FILE_SUFFIX
-
getIdentityFileName
-
getIdentityFileName
- Parameters:
type
- The identity type - e.g.,rsa
- ignored ifnull
/empty- Returns:
- The matching file name for the identity -
null
if no name - See Also:
-