Interface KeyPairResourceParser
-
- All Superinterfaces:
KeyPairResourceLoader
- All Known Subinterfaces:
KeyPairPEMResourceParser
,PuttyKeyPairResourceParser<PUB,PRV>
- All Known Implementing Classes:
AbstractKeyPairResourceParser
,AbstractPEMResourceKeyPairParser
,AbstractPuttyKeyDecoder
,BouncyCastleKeyPairResourceParser
,DSSPEMResourceKeyPairParser
,DSSPuttyKeyDecoder
,ECDSAPEMResourceKeyPairParser
,ECDSAPuttyKeyDecoder
,EdDSAPuttyKeyDecoder
,OpenSSHKeyPairResourceParser
,PKCS8PEMResourceKeyPairParser
,RSAPEMResourceKeyPairParser
,RSAPuttyKeyDecoder
public interface KeyPairResourceParser extends KeyPairResourceLoader
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static KeyPairResourceParser
EMPTY
An empty parser that never fails, but always report that it cannot extract key pairs and returns empty list if asked to load-
Fields inherited from interface org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader
MAX_CIPHER_NAME_LENGTH, MAX_KEY_COMMENT_LENGTH, MAX_KEY_TYPE_NAME_LENGTH, MAX_PRIVATE_KEY_DATA_SIZE, MAX_PUBLIC_KEY_DATA_SIZE
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static KeyPairResourceParser
aggregate(Collection<? extends KeyPairResourceParser> parsers)
static KeyPairResourceParser
aggregate(KeyPairResourceParser... parsers)
boolean
canExtractKeyPairs(NamedResource resourceKey, List<String> lines)
static boolean
containsMarkerLine(List<String> lines, String marker)
static boolean
containsMarkerLine(List<String> lines, List<String> markers)
static byte[]
extractDataBytes(Collection<String> lines)
Converts the lines assumed to contain BASE-64 encoded data into the actual content bytes.static AbstractMap.SimpleImmutableEntry<Integer,Integer>
findMarkerLine(List<String> lines, int startLine, List<String> markers)
Attempts to locate a line that contains one of the markersstatic AbstractMap.SimpleImmutableEntry<Integer,Integer>
findMarkerLine(List<String> lines, List<String> markers)
Attempts to locate a line that contains one of the markersstatic String
joinDataLines(Collection<String> lines)
-
Methods inherited from interface org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader
loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs
-
-
-
-
Field Detail
-
EMPTY
static final KeyPairResourceParser EMPTY
An empty parser that never fails, but always report that it cannot extract key pairs and returns empty list if asked to load
-
-
Method Detail
-
canExtractKeyPairs
boolean canExtractKeyPairs(NamedResource resourceKey, List<String> lines) throws IOException, GeneralSecurityException
- Parameters:
resourceKey
- A hint as to the origin of the text lineslines
- The resource lines- Returns:
true
if the parser can extract some key pairs from the lines- Throws:
IOException
- If failed to process the linesGeneralSecurityException
- If failed to extract information regarding the possibility to extract the key pairs
-
extractDataBytes
static byte[] extractDataBytes(Collection<String> lines)
Converts the lines assumed to contain BASE-64 encoded data into the actual content bytes.- Parameters:
lines
- The data lines - empty lines and spaces are automatically deleted before BASE-64 decoding takes place.- Returns:
- The decoded data bytes
- See Also:
joinDataLines(Collection)
-
joinDataLines
static String joinDataLines(Collection<String> lines)
-
findMarkerLine
static AbstractMap.SimpleImmutableEntry<Integer,Integer> findMarkerLine(List<String> lines, List<String> markers)
Attempts to locate a line that contains one of the markers- Parameters:
lines
- The list of lines to scan - ignored ifnull
/emptymarkers
- The markers to match - ignored ifnull
/empty- Returns:
- A
AbstractMap.SimpleImmutableEntry
whose key is the first line index that matched and value the matched marker index -null
if no match found - See Also:
findMarkerLine(List, int, List)
-
findMarkerLine
static AbstractMap.SimpleImmutableEntry<Integer,Integer> findMarkerLine(List<String> lines, int startLine, List<String> markers)
Attempts to locate a line that contains one of the markers- Parameters:
lines
- The list of lines to scan - ignored ifnull
/emptystartLine
- The scan start line indexmarkers
- The markers to match - ignored ifnull
/empty- Returns:
- A
AbstractMap.SimpleImmutableEntry
whose key is the first line index that matched and value the matched marker index -null
if no match found
-
aggregate
static KeyPairResourceParser aggregate(KeyPairResourceParser... parsers)
-
aggregate
static KeyPairResourceParser aggregate(Collection<? extends KeyPairResourceParser> parsers)
-
-