Class ECDSAPublicKeyEntryDecoder
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.config.keys.impl.AbstractIdentityResourceLoader<PUB,PRV>
-
- org.apache.sshd.common.config.keys.impl.AbstractKeyEntryResolver<PUB,PRV>
-
- org.apache.sshd.common.config.keys.impl.AbstractPublicKeyEntryDecoder<ECPublicKey,ECPrivateKey>
-
- org.apache.sshd.common.config.keys.impl.ECDSAPublicKeyEntryDecoder
-
- All Implemented Interfaces:
IdentityResourceLoader<ECPublicKey,ECPrivateKey>,KeyEntryResolver<ECPublicKey,ECPrivateKey>,KeyTypeNamesSupport,PublicKeyEntryDecoder<ECPublicKey,ECPrivateKey>,PublicKeyEntryResolver,PublicKeyRawDataDecoder<ECPublicKey>
public class ECDSAPublicKeyEntryDecoder extends AbstractPublicKeyEntryDecoder<ECPublicKey,ECPrivateKey>
- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static byteECPOINT_COMPRESSED_VARIANT_2static byteECPOINT_COMPRESSED_VARIANT_3static byteECPOINT_UNCOMPRESSED_FORM_INDICATORstatic ECDSAPublicKeyEntryDecoderINSTANCEstatic intMAX_ALLOWED_POINT_SIZEstatic intMAX_CURVE_NAME_LENGTH-
Fields 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.PublicKeyEntryResolver
FAILING, IGNORING
-
-
Constructor Summary
Constructors Constructor Description ECDSAPublicKeyEntryDecoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ECPrivateKeyclonePrivateKey(ECPrivateKey key)ECPublicKeyclonePublicKey(ECPublicKey key)ECPublicKeydecodePublicKey(SessionContext session, String keyType, InputStream keyData, Map<String,String> headers)StringencodePublicKey(OutputStream s, ECPublicKey key)KeyPairgenerateKeyPair(int keySize)KeyFactorygetKeyFactoryInstance()KeyPairGeneratorgetKeyPairGenerator()-
Methods inherited from class org.apache.sshd.common.config.keys.impl.AbstractPublicKeyEntryDecoder
parseBooleanHeader
-
Methods 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.PublicKeyEntryDecoder
decodePublicKeyByType, resolve
-
Methods inherited from interface org.apache.sshd.common.config.keys.PublicKeyRawDataDecoder
decodePublicKey, decodePublicKey
-
-
-
-
Field Detail
-
MAX_ALLOWED_POINT_SIZE
public static final int MAX_ALLOWED_POINT_SIZE
- See Also:
- Constant Field Values
-
MAX_CURVE_NAME_LENGTH
public static final int MAX_CURVE_NAME_LENGTH
- See Also:
- Constant Field Values
-
INSTANCE
public static final ECDSAPublicKeyEntryDecoder INSTANCE
-
ECPOINT_UNCOMPRESSED_FORM_INDICATOR
public static final byte ECPOINT_UNCOMPRESSED_FORM_INDICATOR
- See Also:
- Constant Field Values
-
ECPOINT_COMPRESSED_VARIANT_2
public static final byte ECPOINT_COMPRESSED_VARIANT_2
- See Also:
- Constant Field Values
-
ECPOINT_COMPRESSED_VARIANT_3
public static final byte ECPOINT_COMPRESSED_VARIANT_3
- See Also:
- Constant Field Values
-
-
Method Detail
-
decodePublicKey
public ECPublicKey decodePublicKey(SessionContext session, String keyType, InputStream keyData, Map<String,String> headers) throws IOException, GeneralSecurityException
- Parameters:
session- TheSessionContextfor invoking this command - may benullif not invoked within a session context (e.g., offline tool or session unknown).keyType- The reported / encode key typekeyData- The key data bytes stream positioned after the key type decoding and making sure it is one of the supported typesheaders- Any headers that may have been available when data was read- Returns:
- The decoded
PublicKey - Throws:
IOException- If failed to read from the data streamGeneralSecurityException- If failed to generate the key
-
clonePublicKey
public ECPublicKey clonePublicKey(ECPublicKey key) throws GeneralSecurityException
- Parameters:
key- ThePublicKeyto clone - ignored ifnull- Returns:
- The cloned key (or
nullif no original key) - Throws:
GeneralSecurityException- If failed to clone the key
-
clonePrivateKey
public ECPrivateKey clonePrivateKey(ECPrivateKey key) throws GeneralSecurityException
- Parameters:
key- ThePrivateKeyto clone - ignored ifnull- Returns:
- The cloned key (or
nullif no original key) - Throws:
GeneralSecurityException- If failed to clone the key
-
encodePublicKey
public String encodePublicKey(OutputStream s, ECPublicKey key) throws IOException
Description copied from interface:PublicKeyEntryDecoder- Parameters:
s- TheOutputStreamto write the data tokey- ThePublicKey- may not benull- Returns:
- The key type value - one of the
KeyTypeNamesSupport.getSupportedKeyTypes() - Throws:
IOException- If failed to generate the encoding
-
getKeyFactoryInstance
public KeyFactory getKeyFactoryInstance() throws GeneralSecurityException
- Returns:
- A
KeyFactorysuitable for the specific decoder type - Throws:
GeneralSecurityException- If failed to create one
-
generateKeyPair
public KeyPair generateKeyPair(int keySize) throws GeneralSecurityException
- Parameters:
keySize- Key size in bits- Returns:
- A
KeyPairwith the specified key size - Throws:
GeneralSecurityException- if unable to generate the pair
-
getKeyPairGenerator
public KeyPairGenerator getKeyPairGenerator() throws GeneralSecurityException
- Returns:
- A
KeyPairGeneratorsuitable for this decoder - Throws:
GeneralSecurityException- If failed to create the generator
-
-