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.
Loads
KeyPairs from text resources-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final KeyPairResourceLoaderAn empty loader that never fails but always returns an empty liststatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptiondefault Collection<KeyPair> loadKeyPairs(SessionContext session, URL url, FilePasswordProvider passwordProvider) default Collection<KeyPair> loadKeyPairs(SessionContext session, URL url, FilePasswordProvider passwordProvider, Charset cs) default Collection<KeyPair> loadKeyPairs(SessionContext session, Path path, FilePasswordProvider passwordProvider, Charset cs, OpenOption... options) default Collection<KeyPair> loadKeyPairs(SessionContext session, Path path, FilePasswordProvider passwordProvider, OpenOption... options) Loads private key data - Note: any non-ASCII characters are assumed to be UTF-8 encodeddefault Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, BufferedReader r) default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, InputStream stream) default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, InputStream stream, Charset cs) default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, Reader r) default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, String data) loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, List<String> lines) Loads key pairs from the given resource text linesdefault Collection<KeyPair> loadKeyPairs(SessionContext session, IoResource<?> resource, FilePasswordProvider passwordProvider) default Collection<KeyPair> loadKeyPairs(SessionContext session, IoResource<?> resource, FilePasswordProvider passwordProvider, Charset cs)
-
Field Details
-
MAX_CIPHER_NAME_LENGTH
static final int MAX_CIPHER_NAME_LENGTH- See Also:
-
MAX_KEY_TYPE_NAME_LENGTH
static final int MAX_KEY_TYPE_NAME_LENGTH- See Also:
-
MAX_KEY_COMMENT_LENGTH
static final int MAX_KEY_COMMENT_LENGTH- See Also:
-
MAX_PUBLIC_KEY_DATA_SIZE
static final int MAX_PUBLIC_KEY_DATA_SIZE- See Also:
-
MAX_PRIVATE_KEY_DATA_SIZE
static final int MAX_PRIVATE_KEY_DATA_SIZE- See Also:
-
EMPTY
An empty loader that never fails but always returns an empty list
-
-
Method Details
-
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- TheSessionContextfor invoking this load command - may benullif not invoked within a session context (e.g., offline tool or session unknown).path- The private key filePathpasswordProvider- TheFilePasswordProviderto use in case the data is encrypted - may benullif no encrypted data is expectedoptions- TheOpenOption-s to use to access the file data- Returns:
- The extracted
KeyPairs - 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:
IOExceptionGeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, URL url, FilePasswordProvider passwordProvider) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, URL url, FilePasswordProvider passwordProvider, Charset cs) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, IoResource<?> resource, FilePasswordProvider passwordProvider) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, IoResource<?> resource, FilePasswordProvider passwordProvider, Charset cs) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, String data) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, InputStream stream) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, InputStream stream, Charset cs) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, Reader r) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
loadKeyPairs
default Collection<KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, BufferedReader r) throws IOException, GeneralSecurityException - Throws:
IOExceptionGeneralSecurityException
-
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- TheSessionContextfor invoking this load command - may benullif not invoked within a session context (e.g., offline tool or session unknown).resourceKey- A hint as to the origin of the text linespasswordProvider- TheFilePasswordProviderto use in case the data is encrypted - may benullif no encrypted data is expectedlines- TheListof lines as read from the resource- Returns:
- The extracted
KeyPairs - 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
-