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
-
-
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(java.util.Collection<? extends KeyPairResourceParser> parsers)
static KeyPairResourceParser
aggregate(KeyPairResourceParser... parsers)
boolean
canExtractKeyPairs(NamedResource resourceKey, java.util.List<java.lang.String> lines)
static boolean
containsMarkerLine(java.util.List<java.lang.String> lines, java.lang.String marker)
static boolean
containsMarkerLine(java.util.List<java.lang.String> lines, java.util.List<java.lang.String> markers)
static byte[]
extractDataBytes(java.util.Collection<java.lang.String> lines)
Converts the lines assumed to contain BASE-64 encoded data into the actual content bytes.static java.util.AbstractMap.SimpleImmutableEntry<java.lang.Integer,java.lang.Integer>
findMarkerLine(java.util.List<java.lang.String> lines, int startLine, java.util.List<java.lang.String> markers)
Attempts to locate a line that contains one of the markersstatic java.util.AbstractMap.SimpleImmutableEntry<java.lang.Integer,java.lang.Integer>
findMarkerLine(java.util.List<java.lang.String> lines, java.util.List<java.lang.String> markers)
Attempts to locate a line that contains one of the markersstatic java.lang.String
joinDataLines(java.util.Collection<java.lang.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, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.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:
java.io.IOException
- If failed to process the linesjava.security.GeneralSecurityException
- If failed to extract information regarding the possibility to extract the key pairs
-
extractDataBytes
static byte[] extractDataBytes(java.util.Collection<java.lang.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 java.lang.String joinDataLines(java.util.Collection<java.lang.String> lines)
-
containsMarkerLine
static boolean containsMarkerLine(java.util.List<java.lang.String> lines, java.lang.String marker)
-
containsMarkerLine
static boolean containsMarkerLine(java.util.List<java.lang.String> lines, java.util.List<java.lang.String> markers)
-
findMarkerLine
static java.util.AbstractMap.SimpleImmutableEntry<java.lang.Integer,java.lang.Integer> findMarkerLine(java.util.List<java.lang.String> lines, java.util.List<java.lang.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 java.util.AbstractMap.SimpleImmutableEntry<java.lang.Integer,java.lang.Integer> findMarkerLine(java.util.List<java.lang.String> lines, int startLine, java.util.List<java.lang.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(java.util.Collection<? extends KeyPairResourceParser> parsers)
-
-