Top Description Fields Constructors Methods
org.apache.sshd.common.kex

public final Enum MontgomeryCurve

extends Enum<MontgomeryCurve>
implements KeySizeIndicator, CurveSizeIndicator, OptionalFeature
Class Inheritance
All Implemented Interfaces
org.apache.sshd.common.OptionalFeature, org.apache.sshd.common.kex.CurveSizeIndicator, org.apache.sshd.common.keyprovider.KeySizeIndicator
Imports
java.security.GeneralSecurityException, .InvalidKeyException, .KeyFactory, .KeyPair, .KeyPairGenerator, .PublicKey, java.security.spec.InvalidKeySpecException, .X509EncodedKeySpec, java.util.Arrays, javax.crypto.KeyAgreement, org.apache.sshd.common.OptionalFeature, org.apache.sshd.common.keyprovider.KeySizeIndicator, org.apache.sshd.common.util.security.SecurityUtils

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
RFC 7748, RFC 8731

Field Summary

Modifier and TypeField and Description
private final String
private final byte[]
private final KeyFactory
private final KeyPairGenerator
private final int
private final boolean
public static final MontgomeryCurve
x25519

X25519 uses Curve25519 and SHA-256 with a 32-byte key size.

public static final MontgomeryCurve
x448

X448 uses Curve448 and SHA-512 with a 56-byte key size.

Constructor Summary

AccessConstructor and Description
private
MontgomeryCurve(String algorithm, int keySize, byte[] encodedPublicKeyPrefix)

Method Summary

Modifier and TypeMethod and Description
public KeyAgreement
public PublicKey
decode(byte[] key)

public byte[]
public KeyPair
public String
public int
getByteLength()

Implements org.apache.sshd.common.kex.CurveSizeIndicator.getByteLength.

Retrieves the length of a point coordinate in bytes.

public int
public boolean
public static MontgomeryCurve
public static MontgomeryCurve[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

algorithmback to summary
private final String algorithm
encodedPublicKeyPrefixback to summary
private final byte[] encodedPublicKeyPrefix
keyFactoryback to summary
private final KeyFactory keyFactory
keyPairGeneratorback to summary
private final KeyPairGenerator keyPairGenerator
keySizeback to summary
private final int keySize
supportedback to summary
private final boolean supported
x25519back to summary
public static final MontgomeryCurve x25519

X25519 uses Curve25519 and SHA-256 with a 32-byte key size.

x448back to summary
public static final MontgomeryCurve x448

X448 uses Curve448 and SHA-512 with a 56-byte key size.

Constructor Detail

MontgomeryCurveback to summary
private MontgomeryCurve(String algorithm, int keySize, byte[] encodedPublicKeyPrefix)

Method Detail

createKeyAgreementback to summary
public KeyAgreement createKeyAgreement() throws GeneralSecurityException
decodeback to summary
public PublicKey decode(byte[] key) throws InvalidKeySpecException
encodeback to summary
public byte[] encode(PublicKey key) throws InvalidKeyException
generateKeyPairback to summary
public KeyPair generateKeyPair()
getAlgorithmback to summary
public String getAlgorithm()
getByteLengthback to summary
public int getByteLength()

Implements org.apache.sshd.common.kex.CurveSizeIndicator.getByteLength.

Doc from org.apache.sshd.common.kex.CurveSizeIndicator.getByteLength.

Retrieves the length of a point coordinate in bytes.

Returns:int

the length

Annotations
@Override
getKeySizeback to summary
public int getKeySize()

Implements org.apache.sshd.common.keyprovider.KeySizeIndicator.getKeySize.

Returns:int

Doc from org.apache.sshd.common.keyprovider.KeySizeIndicator.getKeySize.

The number of bits used in the key

Annotations
@Override
isSupportedback to summary
public boolean isSupported()

Implements org.apache.sshd.common.OptionalFeature.isSupported.

Annotations
@Override
valueOfback to summary
public static MontgomeryCurve valueOf(String name)
valuesback to summary
public static MontgomeryCurve[] values()