public interface KeyPairResourceParser extends KeyPairResourceLoader
Modifier and Type | Field and 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
|
MAX_CIPHER_NAME_LENGTH, MAX_KEY_COMMENT_LENGTH, MAX_KEY_TYPE_NAME_LENGTH, MAX_PRIVATE_KEY_DATA_SIZE, MAX_PUBLIC_KEY_DATA_SIZE
Modifier and Type | Method and 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,
List<String> markers) |
static boolean |
containsMarkerLine(List<String> lines,
String marker) |
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 markers
|
static AbstractMap.SimpleImmutableEntry<Integer,Integer> |
findMarkerLine(List<String> lines,
List<String> markers)
Attempts to locate a line that contains one of the markers
|
static String |
joinDataLines(Collection<String> lines) |
loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs
static final KeyPairResourceParser EMPTY
boolean canExtractKeyPairs(NamedResource resourceKey, List<String> lines) throws IOException, GeneralSecurityException
resourceKey
- A hint as to the origin of the text lineslines
- The resource linestrue
if the parser can extract some key pairs from the linesIOException
- If failed to process the linesGeneralSecurityException
- If failed to extract information regarding
the possibility to extract the key pairsstatic byte[] extractDataBytes(Collection<String> lines)
lines
- The data lines - empty lines and spaces are automatically
deleted before BASE-64 decoding takes place.joinDataLines(Collection)
static String joinDataLines(Collection<String> lines)
static AbstractMap.SimpleImmutableEntry<Integer,Integer> findMarkerLine(List<String> lines, List<String> markers)
lines
- The list of lines to scan - ignored if null
/emptymarkers
- The markers to match - ignored if null
/emptyAbstractMap.SimpleImmutableEntry
whose key is the first line index
that matched and value the matched marker index - null
if no match foundfindMarkerLine(List, int, List)
static AbstractMap.SimpleImmutableEntry<Integer,Integer> findMarkerLine(List<String> lines, int startLine, List<String> markers)
lines
- The list of lines to scan - ignored if null
/emptystartLine
- The scan start line indexmarkers
- The markers to match - ignored if null
/emptyAbstractMap.SimpleImmutableEntry
whose key is the first line index
that matched and value the matched marker index - null
if no match foundstatic KeyPairResourceParser aggregate(KeyPairResourceParser... parsers)
static KeyPairResourceParser aggregate(Collection<? extends KeyPairResourceParser> parsers)
Copyright © 2008–2022 The Apache Software Foundation. All rights reserved.