Top Description Fields Constructors Methods
org.apache.sshd.common.config.keys.loader.pem

public abstract Class AbstractPEMResourceKeyPairParser

extends AbstractKeyPairResourceParser
implements KeyPairPEMResourceParser
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.config.keys.loader.pem.KeyPairPEMResourceParser, org.apache.sshd.common.config.keys.loader.KeyPairResourceParser, org.apache.sshd.common.config.keys.loader.KeyPairResourceLoader, org.apache.sshd.common.AlgorithmNameProvider
Known Direct Subclasses
org.apache.sshd.common.config.keys.loader.pem.DSSPEMResourceKeyPairParser, org.apache.sshd.common.config.keys.loader.pem.ECDSAPEMResourceKeyPairParser, org.apache.sshd.common.config.keys.loader.pem.PKCS8PEMResourceKeyPairParser, org.apache.sshd.common.config.keys.loader.pem.RSAPEMResourceKeyPairParser, org.apache.sshd.common.util.security.eddsa.generic.GenericEd25519PEMResourceKeyParser
Imports
java.io.ByteArrayInputStream, .IOException, .InputStream, .StreamCorruptedException, java.security.GeneralSecurityException, .KeyPair, .NoSuchAlgorithmException, java.util.Arrays, .Collection, .Collections, .List, .Map, .TreeMap, 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, .KeyPairResourceParser, .PrivateKeyEncryptionContext, .PrivateKeyObfuscator, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.GenericUtils, .MapEntryUtils, .NumberUtils, .ValidateUtils, org.apache.sshd.common.util.buffer.BufferUtils

Base class for PEM file key-pair loaders
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private final String
private final String

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected byte[]
applyPrivateKeyCipher(byte[] bytes, PrivateKeyEncryptionContext encContext, boolean encryptIt)

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 String
public String
Inherited from org.apache.sshd.common.config.keys.loader.AbstractKeyPairResourceParser:
canExtractKeyPairsextractKeyPairsextractKeyPairsgetBeginnersgetEndersgetEndingMarkersloadKeyPairsseparateDataLinesFromHeaders

Field Detail

algIdback to summary
private final String algId
algoback to summary
private final String algo

Constructor Detail

AbstractPEMResourceKeyPairParserback to summary
protected AbstractPEMResourceKeyPairParser(String algo, String algId, List<String> beginners, List<String> enders)

Method Detail

applyPrivateKeyCipherback to summary
protected byte[] applyPrivateKeyCipher(byte[] bytes, PrivateKeyEncryptionContext encContext, boolean encryptIt) throws GeneralSecurityException, IOException
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
getAlgorithmback to summary
public String getAlgorithm()

Implements org.apache.sshd.common.AlgorithmNameProvider.getAlgorithm.

Annotations
@Override
getAlgorithmIdentifierback to summary
public String getAlgorithmIdentifier()

Implements org.apache.sshd.common.config.keys.loader.pem.KeyPairPEMResourceParser.getAlgorithmIdentifier.

Returns:String

Doc from org.apache.sshd.common.config.keys.loader.pem.KeyPairPEMResourceParser.getAlgorithmIdentifier.

The OID used to identify this algorithm in DER encodings - e.g., RSA=1.2.840.113549.1.1.1

Annotations
@Override