public abstract class AbstractKeyPairResourceParser extends AbstractLoggingBean implements KeyPairResourceParser
| Modifier and Type | Field and Description |
|---|---|
private java.util.List<java.lang.String> |
beginners |
private java.util.List<java.lang.String> |
enders |
private java.util.List<java.util.List<java.lang.String>> |
endingMarkers |
logEMPTYMAX_CIPHER_NAME_LENGTH, MAX_KEY_COMMENT_LENGTH, MAX_KEY_TYPE_NAME_LENGTH, MAX_PRIVATE_KEY_DATA_SIZE, MAX_PUBLIC_KEY_DATA_SIZE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractKeyPairResourceParser(java.util.List<java.lang.String> beginners,
java.util.List<java.lang.String> enders) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canExtractKeyPairs(NamedResource resourceKey,
java.util.List<java.lang.String> lines) |
java.util.Collection<java.security.KeyPair> |
extractKeyPairs(SessionContext session,
NamedResource resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
FilePasswordProvider passwordProvider,
byte[] bytes,
java.util.Map<java.lang.String,java.lang.String> headers) |
abstract java.util.Collection<java.security.KeyPair> |
extractKeyPairs(SessionContext session,
NamedResource resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
FilePasswordProvider passwordProvider,
java.io.InputStream stream,
java.util.Map<java.lang.String,java.lang.String> headers) |
java.util.Collection<java.security.KeyPair> |
extractKeyPairs(SessionContext session,
NamedResource resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
FilePasswordProvider passwordProvider,
java.util.List<java.lang.String> lines,
java.util.Map<java.lang.String,java.lang.String> headers)
Extracts the key pairs within a single delimited by markers block of lines.
|
java.util.List<java.lang.String> |
getBeginners() |
java.util.List<java.lang.String> |
getEnders() |
java.util.List<java.util.List<java.lang.String>> |
getEndingMarkers() |
java.util.Collection<java.security.KeyPair> |
loadKeyPairs(SessionContext session,
NamedResource resourceKey,
FilePasswordProvider passwordProvider,
java.util.List<java.lang.String> lines)
Loads key pairs from the given resource text lines
|
protected java.util.Map.Entry<java.util.Map<java.lang.String,java.lang.String>,java.util.List<java.lang.String>> |
separateDataLinesFromHeaders(SessionContext session,
NamedResource resourceKey,
java.lang.String startLine,
java.lang.String endLine,
java.util.List<java.lang.String> dataLines) |
getSimplifiedLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaggregate, aggregate, containsMarkerLine, containsMarkerLine, extractDataBytes, findMarkerLine, findMarkerLine, joinDataLinesloadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairsprivate final java.util.List<java.lang.String> beginners
private final java.util.List<java.lang.String> enders
private final java.util.List<java.util.List<java.lang.String>> endingMarkers
protected AbstractKeyPairResourceParser(java.util.List<java.lang.String> beginners,
java.util.List<java.lang.String> enders)
beginners - The markers that indicate the beginning of a parsing blockenders - The matching (by position) markers that indicate the end of a parsing blockpublic java.util.List<java.lang.String> getBeginners()
public java.util.List<java.lang.String> getEnders()
public java.util.List<java.util.List<java.lang.String>> getEndingMarkers()
List of same size as the ending markers, where each ending marker is encapsulated inside a
singleton list and resides as the same index as the marker it encapsulatespublic boolean canExtractKeyPairs(NamedResource resourceKey, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.GeneralSecurityException
canExtractKeyPairs in interface KeyPairResourceParserresourceKey - 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
pairspublic java.util.Collection<java.security.KeyPair> loadKeyPairs(SessionContext session, NamedResource resourceKey, FilePasswordProvider passwordProvider, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.GeneralSecurityException
KeyPairResourceLoaderloadKeyPairs in interface KeyPairResourceLoadersession - The SessionContext for invoking this load command - may be null
if not invoked within a session context (e.g., offline tool or session unknown).resourceKey - A hint as to the origin of the text linespasswordProvider - The FilePasswordProvider to use in case the data is encrypted - may be
null if no encrypted data is expectedlines - The List of lines as read from the resourceKeyPairs - may be null/empty if none. Note:
the resource loader may decide to skip unknown lines if more than one key pair
type is encoded in itjava.io.IOException - If failed to process the linesjava.security.GeneralSecurityException - If failed to generate the keys from the parsed dataprotected java.util.Map.Entry<java.util.Map<java.lang.String,java.lang.String>,java.util.List<java.lang.String>> separateDataLinesFromHeaders(SessionContext session, NamedResource resourceKey, java.lang.String startLine, java.lang.String endLine, java.util.List<java.lang.String> dataLines) throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOExceptionjava.security.GeneralSecurityExceptionpublic java.util.Collection<java.security.KeyPair> extractKeyPairs(SessionContext session, NamedResource resourceKey, java.lang.String beginMarker, java.lang.String endMarker, FilePasswordProvider passwordProvider, java.util.List<java.lang.String> lines, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
session - The SessionContext for invoking this load command - may be null
if not invoked within a session context (e.g., offline tool or session unknown).resourceKey - A hint as to the origin of the text linesbeginMarker - The line containing the begin markerendMarker - The line containing the end markerpasswordProvider - The FilePasswordProvider to use in case the data is encrypted - may be
null if no encryptedlines - The block of lines between the markersheaders - Any headers that may have been available when data was readKeyPairs - may be null/empty if none.java.io.IOException - If failed to parse the datajava.security.GeneralSecurityException - If failed to generate the keyspublic java.util.Collection<java.security.KeyPair> extractKeyPairs(SessionContext session, NamedResource resourceKey, java.lang.String beginMarker, java.lang.String endMarker, FilePasswordProvider passwordProvider, byte[] bytes, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
session - The SessionContext for invoking this load command - may be null
if not invoked within a session context (e.g., offline tool or session unknown).resourceKey - A hint as to the origin of the text linesbeginMarker - The line containing the begin markerendMarker - The line containing the end markerpasswordProvider - The FilePasswordProvider to use in case the data is encrypted - may be
null if no encryptedbytes - The decoded bytes from the lines containing the dataheaders - Any headers that may have been available when data was readKeyPairs - may be null/empty if none.java.io.IOException - If failed to parse the datajava.security.GeneralSecurityException - If failed to generate the keyspublic abstract java.util.Collection<java.security.KeyPair> extractKeyPairs(SessionContext session, NamedResource resourceKey, java.lang.String beginMarker, java.lang.String endMarker, FilePasswordProvider passwordProvider, java.io.InputStream stream, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
session - The SessionContext for invoking this load command - may be null
if not invoked within a session context (e.g., offline tool or session unknown).resourceKey - A hint as to the origin of the text linesbeginMarker - The line containing the begin markerendMarker - The line containing the end markerpasswordProvider - The FilePasswordProvider to use in case the data is encrypted - may be
null if no encryptedstream - The decoded data InputStreamheaders - Any headers that may have been available when data was readKeyPairs - may be null/empty if none.java.io.IOException - If failed to parse the datajava.security.GeneralSecurityException - If failed to generate the keys