Class OpenSSHECDSAPrivateKeyEntryDecoder
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.common.config.keys.impl.AbstractIdentityResourceLoader<ECPublicKey,ECPrivateKey>
org.apache.sshd.common.config.keys.impl.AbstractKeyEntryResolver<ECPublicKey,ECPrivateKey>
org.apache.sshd.common.config.keys.impl.AbstractPrivateKeyEntryDecoder<ECPublicKey,ECPrivateKey>
org.apache.sshd.common.config.keys.loader.openssh.OpenSSHECDSAPrivateKeyEntryDecoder
- All Implemented Interfaces:
IdentityResourceLoader<ECPublicKey,
,ECPrivateKey> KeyEntryResolver<ECPublicKey,
,ECPrivateKey> KeyTypeNamesSupport
,PrivateKeyEntryDecoder<ECPublicKey,
,ECPrivateKey> PrivateKeyEntryResolver
public class OpenSSHECDSAPrivateKeyEntryDecoder
extends AbstractPrivateKeyEntryDecoder<ECPublicKey,ECPrivateKey>
-
Field Summary
FieldsFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
Fields inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
MAX_BIGINT_OCTETS_COUNT
Fields inherited from interface org.apache.sshd.common.config.keys.PrivateKeyEntryResolver
FAILING, IGNORING
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecodePrivateKey
(SessionContext session, String keyType, FilePasswordProvider passwordProvider, InputStream keyData) encodePrivateKey
(SecureByteArrayOutputStream s, ECPrivateKey key, ECPublicKey pubKey) generateKeyPair
(int keySize) recoverPublicKey
(ECPrivateKey prvKey) Attempts to recover the public key given the private oneMethods inherited from class org.apache.sshd.common.config.keys.impl.AbstractKeyEntryResolver
generatePrivateKey, generatePublicKey, toString
Methods inherited from class org.apache.sshd.common.config.keys.impl.AbstractIdentityResourceLoader
getPrivateKeyType, getPublicKeyType, getSupportedKeyTypes
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sshd.common.config.keys.IdentityResourceLoader
getPrivateKeyType, getPublicKeyType
Methods inherited from interface org.apache.sshd.common.config.keys.KeyEntryResolver
cloneKeyPair
Methods inherited from interface org.apache.sshd.common.config.keys.KeyTypeNamesSupport
getSupportedKeyTypes
Methods inherited from interface org.apache.sshd.common.config.keys.PrivateKeyEntryDecoder
decodePrivateKey, decodePrivateKey, decodePrivateKey, isPublicKeyRecoverySupported, resolve
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
OpenSSHECDSAPrivateKeyEntryDecoder
public OpenSSHECDSAPrivateKeyEntryDecoder()
-
-
Method Details
-
decodePrivateKey
public ECPrivateKey decodePrivateKey(SessionContext session, String keyType, FilePasswordProvider passwordProvider, InputStream keyData) throws IOException, GeneralSecurityException - Parameters:
session
- TheSessionContext
for invoking this load command - may benull
if not invoked within a session context (e.g., offline tool or session unknown).keyType
- The reported / encode key typepasswordProvider
- TheFilePasswordProvider
to use in case the data is encrypted - may benull
if 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, ECPrivateKey key, ECPublicKey pubKey) throws IOException Description copied from interface:PrivateKeyEntryDecoder
- Parameters:
s
- TheSecureByteArrayOutputStream
to write the data to.key
- ThePrivateKey
- may not benull
pubKey
- ThePublicKey
belonging to the private key - must be non-null
ifpublic key recovery
is not supported- Returns:
- The key type value - one of the
KeyTypeNamesSupport.getSupportedKeyTypes()
ornull
if encoding not supported - Throws:
IOException
- If failed to generate the encoding
-
recoverPublicKey
Description copied from interface:PrivateKeyEntryDecoder
Attempts to recover the public key given the private one- Parameters:
prvKey
- ThePrivateKey
- Returns:
- The recovered
PublicKey
-null
if cannot recover it - Throws:
GeneralSecurityException
- If failed to generate the public key
-
clonePublicKey
- Parameters:
key
- ThePublicKey
to clone - ignored ifnull
- Returns:
- The cloned key (or
null
if no original key) - Throws:
GeneralSecurityException
- If failed to clone the key
-
clonePrivateKey
- Parameters:
key
- ThePrivateKey
to clone - ignored ifnull
- Returns:
- The cloned key (or
null
if no original key) - Throws:
GeneralSecurityException
- If failed to clone the key
-
getKeyFactoryInstance
- Returns:
- A
KeyFactory
suitable for the specific decoder type - Throws:
GeneralSecurityException
- If failed to create one
-
generateKeyPair
- Parameters:
keySize
- Key size in bits- Returns:
- A
KeyPair
with the specified key size - Throws:
GeneralSecurityException
- if unable to generate the pair
-
getKeyPairGenerator
- Returns:
- A
KeyPairGenerator
suitable for this decoder - Throws:
GeneralSecurityException
- If failed to create the generator
-