Top Fields Constructors Methods
org.apache.sshd.common.util.security.bouncycastle

public Class BouncyCastleKeyPairResourceParser

extends AbstractKeyPairResourceParser
Class Inheritance
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, .InputStreamReader, java.nio.charset.StandardCharsets, java.security.GeneralSecurityException, .KeyPair, .NoSuchProviderException, java.util.Arrays, .Collection, .Collections, .List, .Map, javax.security.auth.login.CredentialException, org.apache.sshd.common.NamedResource, org.apache.sshd.common.config.keys.FilePasswordProvider, org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.io.IoUtils, org.apache.sshd.common.util.security.SecurityProviderRegistrar, .SecurityUtils, org.bouncycastle.openssl.PEMDecryptorProvider, .PEMEncryptedKeyPair, .PEMKeyPair, .PEMParser, org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter, .JcePEMDecryptorProviderBuilder

Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final List<String>
public static final List<String>
public static final BouncyCastleKeyPairResourceParser

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Collection<KeyPair>
extractKeyPairs(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
,
NamedResource
A hint as to the origin of the text lines
resourceKey
,
String
The line containing the begin marker
beginMarker
,
String
The line containing the end marker
endMarker
,
FilePasswordProvider
The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted
passwordProvider
,
List<String>
The block of lines between the markers
lines
,
Map<String, String>
Any headers that may have been available when data was read
headers
)

Overrides org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

Extracts the key pairs within a single delimited by markers block of lines.

public Collection<KeyPair>
extractKeyPairs(SessionContext
The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).
session
,
NamedResource
A hint as to the origin of the text lines
resourceKey
,
String
The line containing the begin marker
beginMarker
,
String
The line containing the end marker
endMarker
,
FilePasswordProvider
The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted
passwordProvider
,
InputStream
The decoded data InputStream
stream
,
Map<String, String>
Any headers that may have been available when data was read
headers
)

Implements abstract org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

public static KeyPair
loadKeyPair(SessionContext session, NamedResource resourceKey, InputStream inputStream, FilePasswordProvider provider)

Inherited from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser:
canExtractKeyPairsextractKeyPairsgetBeginnersgetEndersgetEndingMarkersloadKeyPairsseparateDataLinesFromHeaders

Field Detail

BEGINNERSback to summary
public static final List<String> BEGINNERS
ENDERSback to summary
public static final List<String> ENDERS
INSTANCEback to summary
public static final BouncyCastleKeyPairResourceParser INSTANCE

Constructor Detail

BouncyCastleKeyPairResourceParserback to summary
public BouncyCastleKeyPairResourceParser()

Method Detail

extractKeyPairsback to summary
public Collection<KeyPair> extractKeyPairs(SessionContext session, NamedResource resourceKey, String beginMarker, String endMarker, FilePasswordProvider passwordProvider, List<String> lines, Map<String, String> headers) throws IOException, GeneralSecurityException

Overrides org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

Extracts the key pairs within a single delimited by markers block of lines. By default cleans up the empty lines, joins them and converts them from BASE64

Parameters
session:SessionContext

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:NamedResource

A hint as to the origin of the text lines

beginMarker:String

The line containing the begin marker

endMarker:String

The line containing the end marker

passwordProvider:FilePasswordProvider

The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted

lines:List<String>

The block of lines between the markers

headers:Map<String, String>

Any headers that may have been available when data was read

Returns:Collection<KeyPair>

The extracted KeyPairs - may be null/empty if none.

Annotations
@Override
Exceptions
IOException:
If failed to parse the data
GeneralSecurityException:
If failed to generate the keys
extractKeyPairsback to summary
public Collection<KeyPair> extractKeyPairs(SessionContext session, NamedResource resourceKey, String beginMarker, String endMarker, FilePasswordProvider passwordProvider, InputStream stream, Map<String, String> headers) throws IOException, GeneralSecurityException

Implements abstract org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

Parameters
session:SessionContext

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

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:NamedResource

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

A hint as to the origin of the text lines

beginMarker:String

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

The line containing the begin marker

endMarker:String

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

The line containing the end marker

passwordProvider:FilePasswordProvider

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted

stream:InputStream

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

The decoded data InputStream

headers:Map<String, String>

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

Any headers that may have been available when data was read

Returns:Collection<KeyPair>

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

The extracted KeyPairs - may be null/empty if none.

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

If failed to parse the data

GeneralSecurityException:

Doc from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser.extractKeyPairs.

If failed to generate the keys

loadKeyPairback to summary
public static KeyPair loadKeyPair(SessionContext session, NamedResource resourceKey, InputStream inputStream, FilePasswordProvider provider) throws IOException, GeneralSecurityException