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

public Class OpenSSHDSSPrivateKeyEntryDecoder

extends AbstractPrivateKeyEntryDecoder<DSAPublicKey, DSAPrivateKey>
Class Inheritance
Imports
java.io.IOException, .InputStream, java.math.BigInteger, java.security.GeneralSecurityException, .InvalidKeyException, .KeyFactory, .KeyPairGenerator, java.security.interfaces.DSAParams, .DSAPrivateKey, .DSAPublicKey, java.security.spec.DSAPrivateKeySpec, .DSAPublicKeySpec, .InvalidKeySpecException, java.util.Collections, .Objects, org.apache.sshd.common.config.keys.FilePasswordProvider, .KeyEntryResolver, .KeyUtils, 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.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 OpenSSHDSSPrivateKeyEntryDecoder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public DSAPrivateKey
public DSAPublicKey
public DSAPrivateKey
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
,
DSAPrivateKey
The PrivateKey - may not be null
key
,
DSAPublicKey
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 DSAPublicKey
recoverPublicKey(DSAPrivateKey privateKey)

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

Constructor Detail

OpenSSHDSSPrivateKeyEntryDecoderback to summary
public OpenSSHDSSPrivateKeyEntryDecoder()

Method Detail

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

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

Parameters
key:DSAPrivateKey

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

The PrivateKey to clone - ignored if null

Returns:DSAPrivateKey

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

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

Parameters
key:DSAPublicKey

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

The PublicKey to clone - ignored if null

Returns:DSAPublicKey

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

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, DSAPrivateKey key, DSAPublicKey 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:DSAPrivateKey

The PrivateKey - may not be null

pubKey:DSAPublicKey

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 DSAPublicKey recoverPublicKey(DSAPrivateKey privateKey) 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
privateKey:DSAPrivateKey

The PrivateKey

Returns:DSAPublicKey

The recovered PublicKey - null if cannot recover it

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