Class OpenSSHRSAPrivateKeyDecoder
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.config.keys.impl.AbstractIdentityResourceLoader
org.apache.sshd.common.config.keys.impl.AbstractKeyEntryResolver
org.apache.sshd.common.config.keys.impl.AbstractPrivateKeyEntryDecoder
org.apache.sshd.common.config.keys.loader.openssh.OpenSSHRSAPrivateKeyDecoder
- All Implemented Interfaces:
KeyEntryResolver, KeyTypeNamesSupport, PrivateKeyEntryDecoder, PrivateKeyEntryResolver
- Author:
- Apache MINA SSHD Project
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BigIntegerstatic final OpenSSHRSAPrivateKeyDecoderFields inherited from class AbstractLoggingBean
logFields inherited from interface KeyEntryResolver
MAX_BIGINT_OCTETS_COUNTFields inherited from interface PrivateKeyEntryResolver
FAILING, IGNORING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodePrivateKey(SessionContext session, String keyType, FilePasswordProvider passwordProvider, InputStream keyData) encodePrivateKey(SecureByteArrayOutputStream s, PrivateKey key, PublicKey pubKey) booleanAttempts to recover the public key given the private oneMethods inherited from class AbstractKeyEntryResolver
generatePrivateKey, generatePublicKey, toStringMethods inherited from class AbstractIdentityResourceLoader
getSupportedKeyTypesMethods inherited from class AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warnMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface KeyEntryResolver
generateKeyPairMethods inherited from interface KeyTypeNamesSupport
getSupportedKeyTypesMethods inherited from interface PrivateKeyEntryDecoder
decodePrivateKey, decodePrivateKey, decodePrivateKey, resolve
-
Field Details
-
DEFAULT_PUBLIC_EXPONENT
-
INSTANCE
-
-
Constructor Details
-
OpenSSHRSAPrivateKeyDecoder
public OpenSSHRSAPrivateKeyDecoder()
-
-
Method Details
-
decodePrivateKey
public PrivateKey decodePrivateKey(SessionContext session, String keyType, FilePasswordProvider passwordProvider, InputStream keyData) throws IOException, GeneralSecurityException - Parameters:
session- TheSessionContextfor invoking this load command - may benullif not invoked within a session context (e.g., offline tool or session unknown).keyType- The reported / encode key typepasswordProvider- TheFilePasswordProviderto use in case the data is encrypted - may benullif no encrypted data is expectedkeyData- The key data bytes stream positioned after the key type decoding and making sure it is one of the supported types- Returns:
- The decoded
PrivateKey - Throws:
IOException- If failed to read from the data streamGeneralSecurityException- If failed to generate the key
-
encodePrivateKey
public String encodePrivateKey(SecureByteArrayOutputStream s, PrivateKey key, PublicKey pubKey) throws IOException Description copied from interface:PrivateKeyEntryDecoder- Parameters:
s- TheSecureByteArrayOutputStreamto write the data to.key- ThePrivateKey- may not benullpubKey- ThePublicKeybelonging to the private key - must be non-nullifpublic key recoveryis not supported- Returns:
- The key type value - one of the
KeyTypeNamesSupport.getSupportedKeyTypes()ornullif encoding not supported - Throws:
IOException- If failed to generate the encoding
-
isPublicKeyRecoverySupported
public boolean isPublicKeyRecoverySupported() -
recoverPublicKey
Description copied from interface:PrivateKeyEntryDecoderAttempts to recover the public key given the private one- Parameters:
k- ThePrivateKey- Returns:
- The recovered
PublicKey-nullif cannot recover it - Throws:
GeneralSecurityException- If failed to generate the public key
-
getKeyPairGenerator
- Returns:
- A
KeyPairGeneratorsuitable for this decoder - Throws:
GeneralSecurityException- If failed to create the generator
-
getKeyFactoryInstance
- Returns:
- A
KeyFactorysuitable for the specific decoder type - Throws:
GeneralSecurityException- If failed to create one
-