Class FileKeyPairProvider
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.keyprovider.AbstractKeyPairProvider
-
- org.apache.sshd.common.keyprovider.AbstractResourceKeyPairProvider<java.nio.file.Path>
-
- org.apache.sshd.common.keyprovider.FileKeyPairProvider
-
- All Implemented Interfaces:
KeyIdentityProvider,KeyPairProvider
public class FileKeyPairProvider extends AbstractResourceKeyPairProvider<java.nio.file.Path>
This host key provider loads private keys from the specified files. The loading is lazy - i.e., a file is not loaded until it is actually required. Once required though, its loadedKeyPairresult is cached and not re-loaded.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.sshd.common.keyprovider.AbstractResourceKeyPairProvider
AbstractResourceKeyPairProvider.KeyPairIterator
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Collection<? extends java.nio.file.Path>files-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.common.keyprovider.KeyIdentityProvider
EMPTY_KEYS_PROVIDER
-
Fields inherited from interface org.apache.sshd.common.keyprovider.KeyPairProvider
ECDSA_SHA2_NISTP256, ECDSA_SHA2_NISTP384, ECDSA_SHA2_NISTP521, EMPTY_KEYPAIR_PROVIDER, SSH_DSS, SSH_DSS_CERT, SSH_ECDSA_SHA2_NISTP256_CERT, SSH_ECDSA_SHA2_NISTP384_CERT, SSH_ECDSA_SHA2_NISTP521_CERT, SSH_ED25519, SSH_ED25519_CERT, SSH_RSA, SSH_RSA_CERT
-
-
Constructor Summary
Constructors Constructor Description FileKeyPairProvider()FileKeyPairProvider(java.nio.file.Path path)FileKeyPairProvider(java.nio.file.Path... files)FileKeyPairProvider(java.util.Collection<? extends java.nio.file.Path> files)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Iterable<java.security.KeyPair>doLoadKeys(SessionContext session, java.nio.file.Path resource)protected IoResource<java.nio.file.Path>getIoResource(SessionContext session, java.nio.file.Path resource)java.util.Collection<? extends java.nio.file.Path>getPaths()java.lang.Iterable<java.security.KeyPair>loadKeys(SessionContext session)Load available keys.voidsetPaths(java.util.Collection<? extends java.nio.file.Path> paths)-
Methods inherited from class org.apache.sshd.common.keyprovider.AbstractResourceKeyPairProvider
doLoadKeys, doLoadKeys, getPasswordFinder, loadKeys, openKeyPairResource, resetCacheMap, setPasswordFinder
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.keyprovider.KeyPairProvider
getKeyTypes, loadKey
-
-
-
-
Constructor Detail
-
FileKeyPairProvider
public FileKeyPairProvider()
-
FileKeyPairProvider
public FileKeyPairProvider(java.nio.file.Path path)
-
FileKeyPairProvider
public FileKeyPairProvider(java.nio.file.Path... files)
-
FileKeyPairProvider
public FileKeyPairProvider(java.util.Collection<? extends java.nio.file.Path> files)
-
-
Method Detail
-
getPaths
public java.util.Collection<? extends java.nio.file.Path> getPaths()
-
setPaths
public void setPaths(java.util.Collection<? extends java.nio.file.Path> paths)
-
loadKeys
public java.lang.Iterable<java.security.KeyPair> loadKeys(SessionContext session)
Description copied from interface:KeyIdentityProviderLoad available keys.- Parameters:
session- TheSessionContextfor invoking this load command - may benullif not invoked within a session context (e.g., offline tool or session unknown).- Returns:
- an
Iterableinstance of available keys - ignored ifnull
-
getIoResource
protected IoResource<java.nio.file.Path> getIoResource(SessionContext session, java.nio.file.Path resource)
- Overrides:
getIoResourcein classAbstractResourceKeyPairProvider<java.nio.file.Path>
-
doLoadKeys
protected java.lang.Iterable<java.security.KeyPair> doLoadKeys(SessionContext session, java.nio.file.Path resource) throws java.io.IOException, java.security.GeneralSecurityException
- Overrides:
doLoadKeysin classAbstractResourceKeyPairProvider<java.nio.file.Path>- Throws:
java.io.IOExceptionjava.security.GeneralSecurityException
-
-