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

public Class ECDSAPEMResourceKeyPairParser

extends AbstractPEMResourceKeyPairParser
Class Inheritance
Imports
java.io.IOException, .InputStream, .StreamCorruptedException, java.math.BigInteger, java.security.GeneralSecurityException, .KeyFactory, .KeyPair, .NoSuchProviderException, java.security.interfaces.ECPrivateKey, .ECPublicKey, java.security.spec.ECPoint, .ECPrivateKeySpec, .ECPublicKeySpec, java.util.AbstractMap.SimpleImmutableEntry, .Collection, .Collections, .List, .Map, org.apache.sshd.common.NamedResource, org.apache.sshd.common.cipher.ECCurves, org.apache.sshd.common.config.keys.FilePasswordProvider, .KeyUtils, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.io.der.ASN1Object, .ASN1Type, .DERParser, org.apache.sshd.common.util.io.input.NoCloseInputStream, org.apache.sshd.common.util.security.SecurityUtils

Author
Apache MINA SSHD Project
See Also
RFC 5915

Field Summary

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static final ECPoint
public static Map.Entry<ECPublicKeySpec, ECPrivateKeySpec>
decodeECPrivateKeySpec(ECCurves
The curve represented by this data (in case it was optional and somehow known externally) if null then it is assumed to be part of the parsed data.
curve
,
ASN1Object
The ASN1Object sequence containing the DER encoded data
sequence
)

ASN.1 syntax according to RFC 5915 is:


ECPrivateKey ::= SEQUENCE {
     version        INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
     privateKey     OCTET STRING,
     parameters [0] ECParameters {{ NamedCurve }} OPTIONAL,
     publicKey  [1] BIT STRING OPTIONAL
}

public static Map.Entry<ECPrivateKeySpec, ASN1Object>
public static final ECPoint

Returns:

The encoded ECPoint
decodeECPublicKeyValue
(DERParser
The DERParser assumed to be positioned at the start of the data
parser
)

ASN.1 syntax according to rfc5915 is:


     publicKey  [1] BIT STRING OPTIONAL

public static final ECPoint
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 Map.Entry<ECCurves, ASN1Object>
public static Map.Entry<ECCurves, ASN1Object>
public static KeyPair
parseECKeyPair(InputStream inputStream, boolean okToClose)

public static KeyPair

Returns:

The parsed KeyPair
parseECKeyPair
(ECCurves
The curve represented by this data (in case it was optional and somehow known externally) if null then it is assumed to be part of the parsed data. then it is assumed to be part of the data.
curve
,
DERParser
The DERParser for the data
parser
)

Inherited from org.apache.sshd.common.config.keys.loader.pem.AbstractPEMResourceKeyPairParser:
applyPrivateKeyCipherextractKeyPairsgetAlgorithmgetAlgorithmIdentifier

Field Detail

BEGIN_MARKERback to summary
public static final String BEGIN_MARKER
BEGINNERSback to summary
public static final List<String> BEGINNERS
ECDSA_OIDback to summary
public static final String ECDSA_OID
See Also
RFC-3279 section 2.3.5
END_MARKERback to summary
public static final String END_MARKER
ENDERSback to summary
public static final List<String> ENDERS
INSTANCEback to summary
public static final ECDSAPEMResourceKeyPairParser INSTANCE

Constructor Detail

ECDSAPEMResourceKeyPairParserback to summary
public ECDSAPEMResourceKeyPairParser()

Method Detail

decodeECPointDataback to summary
public static final ECPoint decodeECPointData(ASN1Object pointData) throws IOException
decodeECPrivateKeySpecback to summary
public static Map.Entry<ECPublicKeySpec, ECPrivateKeySpec> decodeECPrivateKeySpec(ECCurves curve, ASN1Object sequence) throws IOException

ASN.1 syntax according to RFC 5915 is:


ECPrivateKey ::= SEQUENCE {
     version        INTEGER { ecPrivkeyVer1(1) } (ecPrivkeyVer1),
     privateKey     OCTET STRING,
     parameters [0] ECParameters {{ NamedCurve }} OPTIONAL,
     publicKey  [1] BIT STRING OPTIONAL
}

ECParameters syntax according to RFC5480:

ECParameters ::= CHOICE {
     namedCurve         OBJECT IDENTIFIER
     -- implicitCurve   NULL
     -- specifiedCurve  SpecifiedECDomain
}

Parameters
curve:ECCurves

The curve represented by this data (in case it was optional and somehow known externally) if null then it is assumed to be part of the parsed data.

sequence:ASN1Object

The ASN1Object sequence containing the DER encoded data

Returns:Map.Entry<ECPublicKeySpec, ECPrivateKeySpec>

The decoded SimpleImmutableEntry of ECPublicKeySpec and ECPrivateKeySpec

Exceptions
IOException:
If failed to to decode the DER stream
decodeECPrivateKeySpecback to summary
public static Map.Entry<ECPrivateKeySpec, ASN1Object> decodeECPrivateKeySpec(ECCurves curve, DERParser parser) throws IOException
decodeECPublicKeyValueback to summary
public static final ECPoint decodeECPublicKeyValue(DERParser parser) throws IOException

ASN.1 syntax according to rfc5915 is:


     publicKey  [1] BIT STRING OPTIONAL

Parameters
parser:DERParser

The DERParser assumed to be positioned at the start of the data

Returns:ECPoint

The encoded ECPoint

Exceptions
IOException:
If failed to create the point
decodeECPublicKeyValueback to summary
public static final ECPoint decodeECPublicKeyValue(ASN1Object dataObject) throws IOException
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

parseCurveParameterback to summary
public static Map.Entry<ECCurves, ASN1Object> parseCurveParameter(DERParser parser) throws IOException
parseCurveParameterback to summary
public static Map.Entry<ECCurves, ASN1Object> parseCurveParameter(ASN1Object paramsObject) throws IOException
parseECKeyPairback to summary
public static KeyPair parseECKeyPair(InputStream inputStream, boolean okToClose) throws IOException, GeneralSecurityException
parseECKeyPairback to summary
public static KeyPair parseECKeyPair(ECCurves curve, DERParser parser) throws IOException, GeneralSecurityException
Parameters
curve:ECCurves

The curve represented by this data (in case it was optional and somehow known externally) if null then it is assumed to be part of the parsed data. then it is assumed to be part of the data.

parser:DERParser

The DERParser for the data

Returns:KeyPair

The parsed KeyPair

Exceptions
IOException:
If failed to parse the data
GeneralSecurityException:
If failed to generate the keys