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 |
log
EMPTY
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(java.lang.String resourceKey,
java.util.List<java.lang.String> lines) |
java.util.Collection<java.security.KeyPair> |
extractKeyPairs(java.lang.String resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
FilePasswordProvider passwordProvider,
byte[] bytes) |
abstract java.util.Collection<java.security.KeyPair> |
extractKeyPairs(java.lang.String resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
FilePasswordProvider passwordProvider,
java.io.InputStream stream) |
java.util.Collection<java.security.KeyPair> |
extractKeyPairs(java.lang.String resourceKey,
java.lang.String beginMarker,
java.lang.String endMarker,
FilePasswordProvider passwordProvider,
java.util.List<java.lang.String> lines)
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(java.lang.String resourceKey,
FilePasswordProvider passwordProvider,
java.util.List<java.lang.String> lines)
Loads key pairs from the given resource text lines
|
getSimplifiedLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aggregate, aggregate, containsMarkerLine, containsMarkerLine, extractDataBytes, findMarkerLine, findMarkerLine, joinDataLines
loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs, loadKeyPairs
private 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(java.lang.String resourceKey, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.GeneralSecurityException
canExtractKeyPairs
in interface KeyPairResourceParser
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 pairspublic java.util.Collection<java.security.KeyPair> loadKeyPairs(java.lang.String resourceKey, FilePasswordProvider passwordProvider, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.GeneralSecurityException
KeyPairResourceLoader
loadKeyPairs
in interface KeyPairResourceLoader
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 resourceKeyPair
s - 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 datapublic java.util.Collection<java.security.KeyPair> extractKeyPairs(java.lang.String resourceKey, java.lang.String beginMarker, java.lang.String endMarker, FilePasswordProvider passwordProvider, java.util.List<java.lang.String> lines) throws java.io.IOException, java.security.GeneralSecurityException
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 markersKeyPair
s - may be null
/empty if none.java.io.IOException
- If failed to parse the datajava.security.GeneralSecurityException
- If failed to generate the keysextractKeyPairs(String, String, String, FilePasswordProvider, byte[])
public java.util.Collection<java.security.KeyPair> extractKeyPairs(java.lang.String resourceKey, java.lang.String beginMarker, java.lang.String endMarker, FilePasswordProvider passwordProvider, byte[] bytes) throws java.io.IOException, java.security.GeneralSecurityException
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 dataKeyPair
s - may be null
/empty if none.java.io.IOException
- If failed to parse the datajava.security.GeneralSecurityException
- If failed to generate the keysextractKeyPairs(String, String, String, FilePasswordProvider, InputStream)
public abstract java.util.Collection<java.security.KeyPair> extractKeyPairs(java.lang.String resourceKey, java.lang.String beginMarker, java.lang.String endMarker, FilePasswordProvider passwordProvider, java.io.InputStream stream) throws java.io.IOException, java.security.GeneralSecurityException
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 InputStream
KeyPair
s - may be null
/empty if none.java.io.IOException
- If failed to parse the datajava.security.GeneralSecurityException
- If failed to generate the keys