Interface KeyPairResourceLoader
-
- All Known Subinterfaces:
KeyPairPEMResourceParser
,KeyPairResourceParser
,PuttyKeyPairResourceParser<PUB,PRV>
- All Known Implementing Classes:
AbstractKeyPairResourceParser
,AbstractPEMResourceKeyPairParser
,AbstractPuttyKeyDecoder
,BouncyCastleKeyPairResourceParser
,DSSPEMResourceKeyPairParser
,DSSPuttyKeyDecoder
,ECDSAPEMResourceKeyPairParser
,ECDSAPuttyKeyDecoder
,Ed25519PEMResourceKeyParser
,EdDSAPuttyKeyDecoder
,FileWatcherKeyPairResourceLoader
,OpenSSHKeyPairResourceParser
,PKCS8PEMResourceKeyPairParser
,RSAPEMResourceKeyPairParser
,RSAPuttyKeyDecoder
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface KeyPairResourceLoader
LoadsKeyPair
s from text resources- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static KeyPairResourceLoader
EMPTY
An empty loader that never fails but always returns an empty liststatic int
MAX_CIPHER_NAME_LENGTH
static int
MAX_KEY_COMMENT_LENGTH
static int
MAX_KEY_TYPE_NAME_LENGTH
static int
MAX_PRIVATE_KEY_DATA_SIZE
static int
MAX_PUBLIC_KEY_DATA_SIZE
-
Method Summary
-
-
-
Field Detail
-
MAX_CIPHER_NAME_LENGTH
static final int MAX_CIPHER_NAME_LENGTH
- See Also:
- Constant Field Values
-
MAX_KEY_TYPE_NAME_LENGTH
static final int MAX_KEY_TYPE_NAME_LENGTH
- See Also:
- Constant Field Values
-
MAX_KEY_COMMENT_LENGTH
static final int MAX_KEY_COMMENT_LENGTH
- See Also:
- Constant Field Values
-
MAX_PUBLIC_KEY_DATA_SIZE
static final int MAX_PUBLIC_KEY_DATA_SIZE
- See Also:
- Constant Field Values
-
MAX_PRIVATE_KEY_DATA_SIZE
static final int MAX_PRIVATE_KEY_DATA_SIZE
- See Also:
- Constant Field Values
-
EMPTY
static final KeyPairResourceLoader EMPTY
An empty loader that never fails but always returns an empty list
-
-
Method Detail
-
loadKeyPairs
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
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool or session unknown).path
- The private key filePath
passwordProvider
- TheFilePasswordProvider
to use in case the data is encrypted - may benull
if no encrypted data is expectedoptions
- TheOpenOption
-s to use to access the file data- Returns:
- The extracted
KeyPair
s - may benull
/empty if none. Note: the resource loader may decide to skip unknown lines if more than one key pair type is encoded in it - Throws:
IOException
- If failed to process the linesGeneralSecurityException
- If failed to generate the keys from the parsed data
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, Path path, FilePasswordProvider passwordProvider, Charset cs, OpenOption... options) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, URL url, FilePasswordProvider passwordProvider) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, URL url, FilePasswordProvider passwordProvider, Charset cs) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, IoResource<?> resource, FilePasswordProvider passwordProvider) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, IoResource<?> resource, FilePasswordProvider passwordProvider, Charset cs) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, String data) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, InputStream stream) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, InputStream stream, Charset cs) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, Reader r) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, BufferedReader r) throws IOException, GeneralSecurityException
- Throws:
IOException
GeneralSecurityException
-
loadKeyPairs
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
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool or session unknown).resourceKey
- A hint as to the origin of the text linespasswordProvider
- TheFilePasswordProvider
to use in case the data is encrypted - may benull
if no encrypted data is expectedlines
- TheList
of lines as read from the resource- Returns:
- The extracted
KeyPair
s - may benull
/empty if none. Note: the resource loader may decide to skip unknown lines if more than one key pair type is encoded in it - Throws:
IOException
- If failed to process the linesGeneralSecurityException
- If failed to generate the keys from the parsed data
-
-