Top Fields Methods
org.apache.sshd.common.config.keys.loader

public Interface KeyPairResourceParser

extends KeyPairResourceLoader
Known Direct Subinterfaces
org.apache.sshd.common.config.keys.loader.pem.KeyPairPEMResourceParser
Known Direct Implementers
org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser
Imports
java.io.IOException, java.security.GeneralSecurityException, .KeyPair, java.util.AbstractMap.SimpleImmutableEntry, .Arrays, .Base64, .Collection, .Collections, .LinkedList, .List, org.apache.sshd.common.NamedResource, org.apache.sshd.common.config.keys.FilePasswordProvider, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.GenericUtils, .ValidateUtils

Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final KeyPairResourceParser
EMPTY

Hides org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader.EMPTY.

An empty parser that never fails, but always report that it cannot extract key pairs and returns empty list if asked to load
Inherited from org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader:
MAX_CIPHER_NAME_LENGTHMAX_KEY_COMMENT_LENGTHMAX_KEY_TYPE_NAME_LENGTHMAX_PRIVATE_KEY_DATA_SIZEMAX_PUBLIC_KEY_DATA_SIZE

Method Summary

Modifier and TypeMethod and Description
public static KeyPairResourceParser
public static KeyPairResourceParser
public boolean

Returns:

true if the parser can extract some key pairs from the lines
canExtractKeyPairs
(NamedResource
A hint as to the origin of the text lines
resourceKey
,
List<String>
The resource lines
lines
)

public static boolean
public static boolean
public static byte[]

Returns:

The decoded data bytes
extractDataBytes
(Collection<String>
The data lines - empty lines and spaces are automatically deleted before BASE-64 decoding takes place.
lines
)

Converts the lines assumed to contain BASE-64 encoded data into the actual content bytes.

public static AbstractMap.SimpleImmutableEntry<Integer, Integer>

Returns:

A SimpleImmutableEntry whose key is the first line index that matched and value the matched marker index - null if no match found
findMarkerLine
(List<String>
The list of lines to scan - ignored if null/empty
lines
,
List<String>
The markers to match - ignored if null/empty
markers
)

Attempts to locate a line that contains one of the markers

public static AbstractMap.SimpleImmutableEntry<Integer, Integer>

Returns:

A SimpleImmutableEntry whose key is the first line index that matched and value the matched marker index - null if no match found
findMarkerLine
(List<String>
The list of lines to scan - ignored if null/empty
lines
,
int
The scan start line index
startLine
,
List<String>
The markers to match - ignored if null/empty
markers
)

Attempts to locate a line that contains one of the markers

public static String
Inherited from org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader:
loadKeyPairsloadKeyPairsloadKeyPairsloadKeyPairsloadKeyPairsloadKeyPairsloadKeyPairsloadKeyPairsloadKeyPairsloadKeyPairsloadKeyPairsloadKeyPairs

Field Detail

EMPTYback to summary
public static final KeyPairResourceParser EMPTY

Hides org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader.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

aggregateback to summary
public static KeyPairResourceParser aggregate(KeyPairResourceParser... parsers)
aggregateback to summary
public static KeyPairResourceParser aggregate(Collection<? extends KeyPairResourceParser> parsers)
canExtractKeyPairsback to summary
public boolean canExtractKeyPairs(NamedResource resourceKey, List<String> lines) throws IOException, GeneralSecurityException
Parameters
resourceKey:NamedResource

A hint as to the origin of the text lines

lines:List<String>

The resource lines

Returns:boolean

true if the parser can extract some key pairs from the lines

Exceptions
IOException:
If failed to process the lines
GeneralSecurityException:
If failed to extract information regarding the possibility to extract the key pairs
containsMarkerLineback to summary
public static boolean containsMarkerLine(List<String> lines, String marker)
containsMarkerLineback to summary
public static boolean containsMarkerLine(List<String> lines, List<String> markers)
extractDataBytesback to summary
public static byte[] extractDataBytes(Collection<String> lines)

Converts the lines assumed to contain BASE-64 encoded data into the actual content bytes.

Parameters
lines:Collection<String>

The data lines - empty lines and spaces are automatically deleted before BASE-64 decoding takes place.

Returns:byte[]

The decoded data bytes

See Also
joinDataLines(Collection)
findMarkerLineback to summary
public static AbstractMap.SimpleImmutableEntry<Integer, Integer> findMarkerLine(List<String> lines, List<String> markers)

Attempts to locate a line that contains one of the markers

Parameters
lines:List<String>

The list of lines to scan - ignored if null/empty

markers:List<String>

The markers to match - ignored if null/empty

Returns:AbstractMap.SimpleImmutableEntry<Integer, Integer>

A 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)
findMarkerLineback to summary
public 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

Parameters
lines:List<String>

The list of lines to scan - ignored if null/empty

startLine:int

The scan start line index

markers:List<String>

The markers to match - ignored if null/empty

Returns:AbstractMap.SimpleImmutableEntry<Integer, Integer>

A SimpleImmutableEntry whose key is the first line index that matched and value the matched marker index - null if no match found

joinDataLinesback to summary
public static String joinDataLines(Collection<String> lines)