Class CachingKeyPairProvider

  • All Implemented Interfaces:
    java.lang.Iterable<java.security.KeyPair>, org.apache.sshd.common.keyprovider.KeyIdentityProvider, org.apache.sshd.common.keyprovider.KeyPairProvider

    public class CachingKeyPairProvider
    extends org.apache.sshd.common.keyprovider.FileKeyPairProvider
    implements java.lang.Iterable<java.security.KeyPair>
    A FileKeyPairProvider that uses an external KeyCache.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private class  CachingKeyPairProvider.CancellingKeyPairIterator  
      • Nested classes/interfaces inherited from class org.apache.sshd.common.keyprovider.AbstractResourceKeyPairProvider

        org.apache.sshd.common.keyprovider.AbstractResourceKeyPairProvider.KeyPairIterator
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private KeyCache cache  
      • 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_ED25519, SSH_RSA
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Iterator<java.security.KeyPair> iterator()  
      private java.util.Iterator<java.security.KeyPair> iterator​(org.apache.sshd.common.session.SessionContext session)  
      private java.security.KeyPair loadKey​(org.apache.sshd.common.session.SessionContext session, java.nio.file.Path path)  
      private java.security.KeyPair loadKey​(org.apache.sshd.common.session.SessionContext session, org.apache.sshd.common.NamedResource resource, java.nio.file.Path path, org.apache.sshd.common.config.keys.FilePasswordProvider passwordProvider)  
      java.lang.Iterable<java.security.KeyPair> loadKeys​(org.apache.sshd.common.session.SessionContext session)  
      • Methods inherited from class org.apache.sshd.common.keyprovider.FileKeyPairProvider

        doLoadKeys, getIoResource, getPaths, setPaths
      • 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

        getSimplifiedLogger
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface org.apache.sshd.common.keyprovider.KeyPairProvider

        getKeyTypes, loadKey
    • Field Detail

    • Constructor Detail

      • CachingKeyPairProvider

        public CachingKeyPairProvider​(java.util.List<java.nio.file.Path> paths,
                                      KeyCache cache)
        Creates a new CachingKeyPairProvider using the given KeyCache. If the cache is null, this is a simple FileKeyPairProvider.
        Parameters:
        paths - to load keys from
        cache - to use, may be null if no external caching is desired
    • Method Detail

      • iterator

        public java.util.Iterator<java.security.KeyPair> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<java.security.KeyPair>
      • iterator

        private java.util.Iterator<java.security.KeyPair> iterator​(org.apache.sshd.common.session.SessionContext session)
      • loadKeys

        public java.lang.Iterable<java.security.KeyPair> loadKeys​(org.apache.sshd.common.session.SessionContext session)
        Specified by:
        loadKeys in interface org.apache.sshd.common.keyprovider.KeyIdentityProvider
        Overrides:
        loadKeys in class org.apache.sshd.common.keyprovider.FileKeyPairProvider
      • loadKey

        private java.security.KeyPair loadKey​(org.apache.sshd.common.session.SessionContext session,
                                              java.nio.file.Path path)
                                       throws java.io.IOException,
                                              java.security.GeneralSecurityException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
      • loadKey

        private java.security.KeyPair loadKey​(org.apache.sshd.common.session.SessionContext session,
                                              org.apache.sshd.common.NamedResource resource,
                                              java.nio.file.Path path,
                                              org.apache.sshd.common.config.keys.FilePasswordProvider passwordProvider)
                                       throws java.io.IOException,
                                              java.security.GeneralSecurityException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException