Class 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 loaded KeyPair result is cached and not re-loaded.
    • Field Detail

      • files

        private java.util.Collection<? extends java.nio.file.Path> files
    • 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: KeyIdentityProvider
        Load available keys.
        Parameters:
        session - The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
        Returns:
        an Iterable instance of available keys - ignored if null
      • doLoadKeys

        protected java.lang.Iterable<java.security.KeyPair> doLoadKeys​(SessionContext session,
                                                                       java.nio.file.Path resource)
                                                                throws java.io.IOException,
                                                                       java.security.GeneralSecurityException
        Overrides:
        doLoadKeys in class AbstractResourceKeyPairProvider<java.nio.file.Path>
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException