Top Fields Constructors Methods
org.apache.sshd.common.util.security.eddsa.generic

public Class GenericOpenSSHEd25519PrivateKeyEntryDecoder<PUB extends PublicKey, PRV extends PrivateKey>

extends AbstractPrivateKeyEntryDecoder<PUB extends PublicKey, PRV extends PrivateKey>
Class Inheritance
Known Direct Subclasses
org.apache.sshd.common.util.security.eddsa.OpenSSHEd25519PrivateKeyEntryDecoder
Imports
java.io.IOException, .InputStream, java.security.GeneralSecurityException, .InvalidKeyException, .KeyFactory, .KeyPairGenerator, .NoSuchAlgorithmException, .PrivateKey, .PublicKey, java.util.Arrays, .Collections, .Locale, .Objects, org.apache.sshd.common.config.keys.FilePasswordProvider, .KeyEntryResolver, org.apache.sshd.common.config.keys.impl.AbstractPrivateKeyEntryDecoder, org.apache.sshd.common.keyprovider.KeyPairProvider, org.apache.sshd.common.session.SessionContext, org.apache.sshd.common.util.GenericUtils, 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
protected final EdDSASupport<PUB, PRV>
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
GenericOpenSSHEd25519PrivateKeyEntryDecoder(Class<PUB> pubType, Class<PRV> prvType, EdDSASupport<PUB, PRV> edDSASupport)

Method Summary

Modifier and TypeMethod and Description
public PRV
public PUB
public PRV
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
,
PRV
The PrivateKey - may not be null
key
,
PUB
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 KeyFactory
public KeyPairGenerator
public boolean
public PUB
recoverPublicKey(PRV prvKey)

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

Attempts to recover the public key given the private one

Field Detail

edDSASupportback to summary
protected final EdDSASupport<PUB, PRV> edDSASupport
KEYPAIR_SIZEback to summary
private static final int KEYPAIR_SIZE
PK_SIZEback to summary
private static final int PK_SIZE
SK_SIZEback to summary
private static final int SK_SIZE

Constructor Detail

GenericOpenSSHEd25519PrivateKeyEntryDecoderback to summary
public GenericOpenSSHEd25519PrivateKeyEntryDecoder(Class<PUB> pubType, Class<PRV> prvType, EdDSASupport<PUB, PRV> edDSASupport)

Method Detail

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

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

Parameters
key:PRV

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

The PrivateKey to clone - ignored if null

Returns:PRV

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 PUB clonePublicKey(PUB key) throws GeneralSecurityException

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

Parameters
key:PUB

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

The PublicKey to clone - ignored if null

Returns:PUB

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

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, PRV key, PUB 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:PRV

The PrivateKey - may not be null

pubKey:PUB

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

isPublicKeyRecoverySupportedback to summary
public boolean isPublicKeyRecoverySupported()

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

Annotations
@Override
recoverPublicKeyback to summary
public PUB recoverPublicKey(PRV 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:PRV

The PrivateKey

Returns:PUB

The recovered PublicKey - null if cannot recover it

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