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

public Class OpenSSHECDSAPrivateKeyEntryDecoder

extends AbstractPrivateKeyEntryDecoder<ECPublicKey, ECPrivateKey>
Class Inheritance
Imports
java.io.IOException, .InputStream, java.math.BigInteger, java.security.GeneralSecurityException, .InvalidKeyException, .KeyFactory, .KeyPair, .KeyPairGenerator, .NoSuchProviderException, java.security.interfaces.ECPrivateKey, .ECPublicKey, java.security.spec.ECParameterSpec, .ECPrivateKeySpec, .ECPublicKeySpec, .InvalidKeySpecException, java.util.Objects, org.apache.sshd.common.cipher.ECCurves, org.apache.sshd.common.config.keys.FilePasswordProvider, .KeyEntryResolver, .KeyUtils, org.apache.sshd.common.config.keys.impl.AbstractPrivateKeyEntryDecoder, .ECDSAPublicKeyEntryDecoder, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.io.output.SecureByteArrayOutputStream, org.apache.sshd.common.util.security.SecurityUtils

Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
public static final OpenSSHECDSAPrivateKeyEntryDecoder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ECPrivateKey
public ECPublicKey
public ECPrivateKey
decodePrivateKey(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
,
String
The reported / encode key type
keyType
,
FilePasswordProvider
The FilePasswordProvider to use in case the data is encrypted - may be null if no encrypted data is expected
passwordProvider
,
InputStream
The key data bytes stream positioned after the key type decoding and making sure it is one of the supported types
keyData
)

Implements org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.decodePrivateKey.

public String
encodePrivateKey(SecureByteArrayOutputStream
The SecureByteArrayOutputStream to write the data to.
s
,
ECPrivateKey
The PrivateKey - may not be null
key
,
ECPublicKey
The PublicKey belonging to the private key - must be non-null if public key recovery is not supported
pubKey
)

Overrides default org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.encodePrivateKey.

Encodes the PrivateKey using the OpenSSH format - same one used by the decodePublicKey method(s)

public KeyPair
public KeyFactory
public KeyPairGenerator
public ECPublicKey
recoverPublicKey(ECPrivateKey prvKey)

Overrides default org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.recoverPublicKey.

Attempts to recover the public key given the private one

Field Detail

INSTANCEback to summary
public static final OpenSSHECDSAPrivateKeyEntryDecoder INSTANCE

Constructor Detail

OpenSSHECDSAPrivateKeyEntryDecoderback to summary
public OpenSSHECDSAPrivateKeyEntryDecoder()

Method Detail

clonePrivateKeyback to summary
public ECPrivateKey clonePrivateKey(ECPrivateKey key) throws GeneralSecurityException

Implements org.apache.sshd.common.config.keys.KeyEntryResolver.clonePrivateKey.

Parameters
key:ECPrivateKey

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.clonePrivateKey.

The PrivateKey to clone - ignored if null

Returns:ECPrivateKey

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.clonePrivateKey.

The cloned key (or null if no original key)

Annotations
@Override
Exceptions
GeneralSecurityException:

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.clonePrivateKey.

If failed to clone the key

clonePublicKeyback to summary
public ECPublicKey clonePublicKey(ECPublicKey key) throws GeneralSecurityException

Implements org.apache.sshd.common.config.keys.KeyEntryResolver.clonePublicKey.

Parameters
key:ECPublicKey

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.clonePublicKey.

The PublicKey to clone - ignored if null

Returns:ECPublicKey

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.clonePublicKey.

The cloned key (or null if no original key)

Annotations
@Override
Exceptions
GeneralSecurityException:

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.clonePublicKey.

If failed to clone the key

decodePrivateKeyback to summary
public ECPrivateKey decodePrivateKey(SessionContext session, String keyType, FilePasswordProvider passwordProvider, InputStream keyData) throws IOException, GeneralSecurityException

Implements org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.decodePrivateKey.

Parameters
session:SessionContext

Doc from org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.decodePrivateKey.

The SessionContext for invoking this load command - may be null if not invoked within a session context (e.g., offline tool or session unknown).

keyType:String

Doc from org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.decodePrivateKey.

The reported / encode key type

passwordProvider:FilePasswordProvider

Doc from org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.decodePrivateKey.

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

keyData:InputStream

Doc from org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.decodePrivateKey.

The key data bytes stream positioned after the key type decoding and making sure it is one of the supported types

Returns:ECPrivateKey

Doc from org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.decodePrivateKey.

The decoded PrivateKey

Annotations
@Override
Exceptions
IOException:

Doc from org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.decodePrivateKey.

If failed to read from the data stream

GeneralSecurityException:

Doc from org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.decodePrivateKey.

If failed to generate the key

encodePrivateKeyback to summary
public String encodePrivateKey(SecureByteArrayOutputStream s, ECPrivateKey key, ECPublicKey pubKey) throws IOException

Overrides default org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.encodePrivateKey.

Doc from org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.encodePrivateKey.

Encodes the PrivateKey using the OpenSSH format - same one used by the decodePublicKey method(s)

Parameters
s:SecureByteArrayOutputStream

The SecureByteArrayOutputStream to write the data to.

key:ECPrivateKey

The PrivateKey - may not be null

pubKey:ECPublicKey

The PublicKey belonging to the private key - must be non-null if public key recovery is not supported

Returns:String

The key type value - one of the getSupportedKeyTypes() or null if encoding not supported

Annotations
@Override
Exceptions
IOException:
If failed to generate the encoding
generateKeyPairback to summary
public KeyPair generateKeyPair(int keySize) throws GeneralSecurityException

Overrides default org.apache.sshd.common.config.keys.KeyEntryResolver.generateKeyPair.

Parameters
keySize:int

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.generateKeyPair.

Key size in bits

Returns:KeyPair

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.generateKeyPair.

A KeyPair with the specified key size

Annotations
@Override
Exceptions
GeneralSecurityException:

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.generateKeyPair.

if unable to generate the pair

getKeyFactoryInstanceback to summary
public KeyFactory getKeyFactoryInstance() throws GeneralSecurityException

Implements org.apache.sshd.common.config.keys.KeyEntryResolver.getKeyFactoryInstance.

Returns:KeyFactory

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.getKeyFactoryInstance.

A KeyFactory suitable for the specific decoder type

Annotations
@Override
Exceptions
GeneralSecurityException:

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.getKeyFactoryInstance.

If failed to create one

getKeyPairGeneratorback to summary
public KeyPairGenerator getKeyPairGenerator() throws GeneralSecurityException

Implements org.apache.sshd.common.config.keys.KeyEntryResolver.getKeyPairGenerator.

Returns:KeyPairGenerator

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.getKeyPairGenerator.

A KeyPairGenerator suitable for this decoder

Annotations
@Override
Exceptions
GeneralSecurityException:

Doc from org.apache.sshd.common.config.keys.KeyEntryResolver.getKeyPairGenerator.

If failed to create the generator

recoverPublicKeyback to summary
public ECPublicKey recoverPublicKey(ECPrivateKey prvKey) throws GeneralSecurityException

Overrides default org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.recoverPublicKey.

Doc from org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder.recoverPublicKey.

Attempts to recover the public key given the private one

Parameters
prvKey:ECPrivateKey

The PrivateKey

Returns:ECPublicKey

The recovered PublicKey - null if cannot recover it

Annotations
@Override
Exceptions
GeneralSecurityException:
If failed to generate the public key