Enum MontgomeryCurve

java.lang.Object
java.lang.Enum<MontgomeryCurve>
org.apache.sshd.common.kex.MontgomeryCurve
All Implemented Interfaces:
Serializable, Comparable<MontgomeryCurve>, CurveSizeIndicator, org.apache.sshd.common.keyprovider.KeySizeIndicator, org.apache.sshd.common.OptionalFeature

public enum MontgomeryCurve extends Enum<MontgomeryCurve> implements org.apache.sshd.common.keyprovider.KeySizeIndicator, CurveSizeIndicator, org.apache.sshd.common.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 Details

    • x25519

      public static final MontgomeryCurve x25519
      X25519 uses Curve25519 and SHA-256 with a 32-byte key size.
    • x448

      public static final MontgomeryCurve x448
      X448 uses Curve448 and SHA-512 with a 56-byte key size.
  • Method Details

    • values

      public static MontgomeryCurve[] 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

      public static MontgomeryCurve valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getAlgorithm

      public String getAlgorithm()
    • getByteLength

      public int getByteLength()
      Description copied from interface: CurveSizeIndicator
      Retrieves the length of a point coordinate in bytes.
      Specified by:
      getByteLength in interface CurveSizeIndicator
      Returns:
      the length
    • getKeySize

      public int getKeySize()
      Specified by:
      getKeySize in interface org.apache.sshd.common.keyprovider.KeySizeIndicator
    • isSupported

      public boolean isSupported()
      Specified by:
      isSupported in interface org.apache.sshd.common.OptionalFeature
    • createKeyAgreement

      public KeyAgreement createKeyAgreement() throws GeneralSecurityException
      Throws:
      GeneralSecurityException
    • generateKeyPair

      public KeyPair generateKeyPair()
    • encode

      public byte[] encode(PublicKey key) throws InvalidKeyException
      Throws:
      InvalidKeyException
    • decode

      public PublicKey decode(byte[] key) throws InvalidKeySpecException
      Throws:
      InvalidKeySpecException