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(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.util.List<java.lang.String> markers) |
static boolean |
containsMarkerLine(java.util.List<java.lang.String> lines,
java.lang.String marker) |
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 markers
|
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
|
static java.lang.String |
joinDataLines(java.util.Collection<java.lang.String> lines) |
loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs
static final KeyPairResourceParser EMPTY
boolean canExtractKeyPairs(NamedResource resourceKey, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.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 linesjava.io.IOException
- If failed to process the linesjava.security.GeneralSecurityException
- If failed to extract information regarding the possibility to extract the key
pairsstatic byte[] extractDataBytes(java.util.Collection<java.lang.String> lines)
lines
- The data lines - empty lines and spaces are automatically deleted before BASE-64 decoding
takes place.joinDataLines(Collection)
static java.lang.String joinDataLines(java.util.Collection<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 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)
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 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)
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(java.util.Collection<? extends KeyPairResourceParser> parsers)