Top Description Fields Methods
org.apache.sshd.common.config.keys.loader

public Interface KeyPairResourceLoader

Known Direct Subinterfaces
org.apache.sshd.common.config.keys.loader.KeyPairResourceParser
Known Direct Implementers
org.apache.sshd.common.config.keys.loader.FileWatcherKeyPairResourceLoader
Annotations
@FunctionalInterface
Imports
java.io.BufferedReader, .IOException, .InputStream, .InputStreamReader, .Reader, .StringReader, java.net.URL, java.nio.charset.Charset, .StandardCharsets, java.nio.file.OpenOption, .Path, java.security.GeneralSecurityException, .KeyPair, java.util.Collection, .Collections, .List, .Objects, org.apache.sshd.common.NamedResource, org.apache.sshd.common.config.keys.FilePasswordProvider, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.io.IoUtils, org.apache.sshd.common.util.io.resource.IoResource, .PathResource, .URLResource

Loads KeyPairs from text resources
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final KeyPairResourceLoader
EMPTY

An empty loader that never fails but always returns an empty list

public static final int
public static final int
public static final int
public static final int
public static final int

Method Summary

Modifier and TypeMethod and Description
public default Collection<KeyPair>

Returns:

The extracted KeyPairs - may be null/empty if none

Note

the resource loader may decide to skip unknown lines if more than one key pair type is encoded in it

loadKeyPairs
(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
,
Path
The private key file Path
path
,
FilePasswordProvider
The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted data is expected
passwordProvider
,
OpenOption...
The OpenOption-s to use to access the file data
options
)

Loads private key data - Note: any non-ASCII characters are assumed to be UTF-8 encoded

public default Collection<KeyPair>
loadKeyPairs(SessionContext session, Path path, FilePasswordProvider passwordProvider, Charset cs, OpenOption... options)

public default Collection<KeyPair>
loadKeyPairs(SessionContext session, URL url, FilePasswordProvider passwordProvider)

public default Collection<KeyPair>
loadKeyPairs(SessionContext session, URL url, FilePasswordProvider passwordProvider, Charset cs)

public default Collection<KeyPair>
loadKeyPairs(SessionContext session, IoResource<?> resource, FilePasswordProvider passwordProvider)

public default Collection<KeyPair>
loadKeyPairs(SessionContext session, IoResource<?> resource, FilePasswordProvider passwordProvider, Charset cs)

public default Collection<KeyPair>
loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, String data)

public default Collection<KeyPair>
loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, InputStream stream)

public default Collection<KeyPair>
loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, InputStream stream, Charset cs)

public default Collection<KeyPair>
loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, Reader r)

public default Collection<KeyPair>
public Collection<KeyPair>

Returns:

The extracted KeyPairs - may be null/empty if none

Note

the resource loader may decide to skip unknown lines if more than one key pair type is encoded in it

loadKeyPairs
(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
,
NamedResource
A hint as to the origin of the text lines
resourceKey
,
FilePasswordProvider
The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted data is expected
passwordProvider
,
List<String>
The List of lines as read from the resource
lines
)

Loads key pairs from the given resource text lines

Field Detail

EMPTYback to summary
public static final KeyPairResourceLoader EMPTY

An empty loader that never fails but always returns an empty list

MAX_CIPHER_NAME_LENGTHback to summary
public static final int MAX_CIPHER_NAME_LENGTH
MAX_KEY_COMMENT_LENGTHback to summary
public static final int MAX_KEY_COMMENT_LENGTH
MAX_KEY_TYPE_NAME_LENGTHback to summary
public static final int MAX_KEY_TYPE_NAME_LENGTH
MAX_PRIVATE_KEY_DATA_SIZEback to summary
public static final int MAX_PRIVATE_KEY_DATA_SIZE
MAX_PUBLIC_KEY_DATA_SIZEback to summary
public static final int MAX_PUBLIC_KEY_DATA_SIZE

Method Detail

loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, Path path, FilePasswordProvider passwordProvider, OpenOption... options) throws IOException, GeneralSecurityException

Loads private key data - Note: any non-ASCII characters are assumed to be UTF-8 encoded

Parameters
session:SessionContext

The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).

path:Path

The private key file Path

passwordProvider:FilePasswordProvider

The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted data is expected

options:OpenOption[]

The OpenOption-s to use to access the file data

Returns:Collection<KeyPair>

The extracted KeyPairs - may be null/empty if none

Note

the resource loader may decide to skip unknown lines if more than one key pair type is encoded in it

Exceptions
IOException:
If failed to process the lines
GeneralSecurityException:
If failed to generate the keys from the parsed data
loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, Path path, FilePasswordProvider passwordProvider, Charset cs, OpenOption... options) throws IOException, GeneralSecurityException
loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, URL url, FilePasswordProvider passwordProvider) throws IOException, GeneralSecurityException
loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, URL url, FilePasswordProvider passwordProvider, Charset cs) throws IOException, GeneralSecurityException
loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, IoResource<?> resource, FilePasswordProvider passwordProvider) throws IOException, GeneralSecurityException
loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, IoResource<?> resource, FilePasswordProvider passwordProvider, Charset cs) throws IOException, GeneralSecurityException
loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, String data) throws IOException, GeneralSecurityException
loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, InputStream stream) throws IOException, GeneralSecurityException
loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, InputStream stream, Charset cs) throws IOException, GeneralSecurityException
loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, Reader r) throws IOException, GeneralSecurityException
loadKeyPairsback to summary
public default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, BufferedReader r) throws IOException, GeneralSecurityException
loadKeyPairsback to summary
public Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, List<String> lines) throws IOException, GeneralSecurityException

Loads key pairs from the given resource text lines

Parameters
session:SessionContext

The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).

resourceKey:NamedResource

A hint as to the origin of the text lines

passwordProvider:FilePasswordProvider

The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted data is expected

lines:List<String>

The List of lines as read from the resource

Returns:Collection<KeyPair>

The extracted KeyPairs - may be null/empty if none

Note

the resource loader may decide to skip unknown lines if more than one key pair type is encoded in it

Exceptions
IOException:
If failed to process the lines
GeneralSecurityException:
If failed to generate the keys from the parsed data