Package org.apache.sshd.common.kex
Enum MontgomeryCurve
- All Implemented Interfaces:
Serializable,Comparable<MontgomeryCurve>,KeySizeIndicator,OptionalFeature
public enum MontgomeryCurve
extends Enum<MontgomeryCurve>
implements KeySizeIndicator, OptionalFeature
Provides implementation details for Montgomery curves and their key exchange algorithms Curve25519/X25519 and
Curve448/X448 specified in RFC 7748 and RFC 8731. Montgomery curves provide improved security and flexibility over
Weierstrass curves used in ECDH.
- See Also:
-
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final DigestFactoryprivate final byte[]private final KeyFactoryprivate final KeyPairGeneratorprivate final intprivate final booleanFields inherited from interface org.apache.sshd.common.OptionalFeature
FALSE, TRUE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMontgomeryCurve(String algorithm, int keySize, DigestFactory digestFactory, byte[] encodedPublicKeyPrefix) -
Method Summary
Modifier and TypeMethodDescriptiondecode(byte[] key) byte[]intbooleanstatic MontgomeryCurveReturns the enum constant of this type with the specified name.static MontgomeryCurve[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
x25519
X25519 uses Curve25519 and SHA-256 with a 32-byte key size. -
x448
X448 uses Curve448 and SHA-512 with a 56-byte key size.
-
-
Field Details
-
algorithm
-
keySize
private final int keySize -
supported
private final boolean supported -
digestFactory
-
keyPairGenerator
-
keyFactory
-
encodedPublicKeyPrefix
private final byte[] encodedPublicKeyPrefix
-
-
Constructor Details
-
MontgomeryCurve
private MontgomeryCurve(String algorithm, int keySize, DigestFactory digestFactory, byte[] encodedPublicKeyPrefix)
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getAlgorithm
-
getKeySize
public int getKeySize()- Specified by:
getKeySizein interfaceKeySizeIndicator- Returns:
- The number of bits used in the key
-
isSupported
public boolean isSupported()- Specified by:
isSupportedin interfaceOptionalFeature
-
createKeyAgreement
- Throws:
GeneralSecurityException
-
createDigest
-
generateKeyPair
-
encode
- Throws:
InvalidKeyException
-
decode
- Throws:
InvalidKeySpecException
-