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<java.security.interfaces.ECPublicKey,java.security.interfaces.ECPrivateKey>
-
- org.apache.sshd.common.config.keys.impl.ECDSAPublicKeyEntryDecoder
-
- All Implemented Interfaces:
IdentityResourceLoader<java.security.interfaces.ECPublicKey,java.security.interfaces.ECPrivateKey>
,KeyEntryResolver<java.security.interfaces.ECPublicKey,java.security.interfaces.ECPrivateKey>
,KeyTypeNamesSupport
,PublicKeyEntryDecoder<java.security.interfaces.ECPublicKey,java.security.interfaces.ECPrivateKey>
,PublicKeyEntryResolver
,PublicKeyRawDataDecoder<java.security.interfaces.ECPublicKey>
public class ECDSAPublicKeyEntryDecoder extends AbstractPublicKeyEntryDecoder<java.security.interfaces.ECPublicKey,java.security.interfaces.ECPrivateKey>
-
-
Field Summary
Fields Modifier and Type Field Description static byte
ECPOINT_COMPRESSED_VARIANT_2
static byte
ECPOINT_COMPRESSED_VARIANT_3
static byte
ECPOINT_UNCOMPRESSED_FORM_INDICATOR
static ECDSAPublicKeyEntryDecoder
INSTANCE
static int
MAX_ALLOWED_POINT_SIZE
static int
MAX_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 Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.interfaces.ECPrivateKey
clonePrivateKey(java.security.interfaces.ECPrivateKey key)
java.security.interfaces.ECPublicKey
clonePublicKey(java.security.interfaces.ECPublicKey key)
(package private) java.security.interfaces.ECPublicKey
decodePublicKey(ECCurves curve, java.io.InputStream keyData)
java.security.interfaces.ECPublicKey
decodePublicKey(SessionContext session, java.lang.String keyType, java.io.InputStream keyData, java.util.Map<java.lang.String,java.lang.String> headers)
(package private) static void
encodePublicKey(java.io.OutputStream s, java.lang.String keyType, ECCurves curve, java.security.spec.ECPoint w)
java.lang.String
encodePublicKey(java.io.OutputStream s, java.security.interfaces.ECPublicKey key)
Encodes thePublicKey
using theOpenSSH
format - same one used by thedecodePublicKey
method(s)java.security.KeyPair
generateKeyPair(int keySize)
java.security.KeyFactory
getKeyFactoryInstance()
java.security.KeyPairGenerator
getKeyPairGenerator()
-
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 java.security.interfaces.ECPublicKey decodePublicKey(SessionContext session, java.lang.String keyType, java.io.InputStream keyData, java.util.Map<java.lang.String,java.lang.String> headers) throws java.io.IOException, java.security.GeneralSecurityException
- Parameters:
session
- TheSessionContext
for invoking this command - may benull
if 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:
java.io.IOException
- If failed to read from the data streamjava.security.GeneralSecurityException
- If failed to generate the key
-
decodePublicKey
java.security.interfaces.ECPublicKey decodePublicKey(ECCurves curve, java.io.InputStream keyData) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
clonePublicKey
public java.security.interfaces.ECPublicKey clonePublicKey(java.security.interfaces.ECPublicKey key) throws java.security.GeneralSecurityException
- Parameters:
key
- ThePublicKey
to clone - ignored ifnull
- Returns:
- The cloned key (or
null
if no original key) - Throws:
java.security.GeneralSecurityException
- If failed to clone the key
-
clonePrivateKey
public java.security.interfaces.ECPrivateKey clonePrivateKey(java.security.interfaces.ECPrivateKey key) throws java.security.GeneralSecurityException
- Parameters:
key
- ThePrivateKey
to clone - ignored ifnull
- Returns:
- The cloned key (or
null
if no original key) - Throws:
java.security.GeneralSecurityException
- If failed to clone the key
-
encodePublicKey
public java.lang.String encodePublicKey(java.io.OutputStream s, java.security.interfaces.ECPublicKey key) throws java.io.IOException
Description copied from interface:PublicKeyEntryDecoder
Encodes thePublicKey
using theOpenSSH
format - same one used by thedecodePublicKey
method(s)- Parameters:
s
- TheOutputStream
to write the data tokey
- ThePublicKey
- may not benull
- Returns:
- The key type value - one of the
KeyTypeNamesSupport.getSupportedKeyTypes()
- Throws:
java.io.IOException
- If failed to generate the encoding
-
encodePublicKey
static void encodePublicKey(java.io.OutputStream s, java.lang.String keyType, ECCurves curve, java.security.spec.ECPoint w) throws java.io.IOException
- Throws:
java.io.IOException
-
getKeyFactoryInstance
public java.security.KeyFactory getKeyFactoryInstance() throws java.security.GeneralSecurityException
- Returns:
- A
KeyFactory
suitable for the specific decoder type - Throws:
java.security.GeneralSecurityException
- If failed to create one
-
generateKeyPair
public java.security.KeyPair generateKeyPair(int keySize) throws java.security.GeneralSecurityException
- Parameters:
keySize
- Key size in bits- Returns:
- A
KeyPair
with the specified key size - Throws:
java.security.GeneralSecurityException
- if unable to generate the pair
-
getKeyPairGenerator
public java.security.KeyPairGenerator getKeyPairGenerator() throws java.security.GeneralSecurityException
- Returns:
- A
KeyPairGenerator
suitable for this decoder - Throws:
java.security.GeneralSecurityException
- If failed to create the generator
-
-