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

public Class OpenSSHRSAPrivateKeyDecoder

extends AbstractPrivateKeyEntryDecoder<RSAPublicKey, RSAPrivateKey>
Class Inheritance
Imports
java.io.IOException, .InputStream, java.math.BigInteger, java.security.GeneralSecurityException, .InvalidKeyException, .KeyFactory, .KeyPairGenerator, java.security.interfaces.RSAPrivateCrtKey, .RSAPrivateKey, .RSAPublicKey, java.security.spec.InvalidKeySpecException, .RSAPrivateCrtKeySpec, .RSAPublicKeySpec, 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 BigInteger
public static final OpenSSHRSAPrivateKeyDecoder

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

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

Attempts to recover the public key given the private one

Field Detail

DEFAULT_PUBLIC_EXPONENTback to summary
public static final BigInteger DEFAULT_PUBLIC_EXPONENT
INSTANCEback to summary
public static final OpenSSHRSAPrivateKeyDecoder INSTANCE

Constructor Detail

OpenSSHRSAPrivateKeyDecoderback to summary
public OpenSSHRSAPrivateKeyDecoder()

Method Detail

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

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

Parameters
key:RSAPrivateKey

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

The PrivateKey to clone - ignored if null

Returns:RSAPrivateKey

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

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

Parameters
key:RSAPublicKey

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

The PublicKey to clone - ignored if null

Returns:RSAPublicKey

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

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, RSAPrivateKey key, RSAPublicKey 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:RSAPrivateKey

The PrivateKey - may not be null

pubKey:RSAPublicKey

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 RSAPublicKey recoverPublicKey(RSAPrivateKey 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:RSAPrivateKey

The PrivateKey

Returns:RSAPublicKey

The recovered PublicKey - null if cannot recover it

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