Enum Class EcdsaCurveSpec

java.lang.Object
java.lang.Enum<EcdsaCurveSpec>
zeroecho.core.alg.ecdsa.EcdsaCurveSpec
All Implemented Interfaces:
Serializable, Comparable<EcdsaCurveSpec>, Constable, Describable, AlgorithmKeySpec, ContextSpec

public enum EcdsaCurveSpec extends Enum<EcdsaCurveSpec> implements ContextSpec, AlgorithmKeySpec, Describable

ECDSA Curve Specifications

Enumeration of supported elliptic curve domain parameters for the EcdsaAlgorithm. Each value binds a named curve, its associated JCA signature algorithm string, and the fixed-length of produced signatures in bytes (P1363 format).

Curves

  • P256 - NIST P-256 (secp256r1), 64-byte signatures, SHA-256 digest binding.
  • P384 - NIST P-384 (secp384r1), 96-byte signatures, SHA-384 digest binding.
  • P512 - NIST P-521 (secp521r1), 132-byte signatures, SHA-512 digest binding.

Usage

The specification is used both as a ContextSpec for signature contexts and as an AlgorithmKeySpec for key pair generation or import. It ensures consistent algorithm selection and enforces deterministic signature lengths.
// Example: select curve specification
EcdsaCurveSpec spec = EcdsaCurveSpec.P256;
String curve = spec.curveName(); // "secp256r1"
String jcaAlg = spec.jcaFactory(); // "SHA256withECDSAinP1363Format"
int sigLen = spec.signFixedLength(); // 64
Since:
1.0
  • Enum Constant Details

    • P256

      public static final EcdsaCurveSpec P256
      NIST P-256 (secp256r1), SHA-256 binding, 64-byte signatures.
    • P384

      public static final EcdsaCurveSpec P384
      NIST P-384 (secp384r1), SHA-384 binding, 96-byte signatures.
    • P512

      public static final EcdsaCurveSpec P512
      NIST P-521 (secp521r1), SHA-512 binding, 132-byte signatures.
  • Method Details

    • values

      public static EcdsaCurveSpec[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static EcdsaCurveSpec valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null
    • curveName

      public String curveName()
      Returns the canonical JCA curve name.
      Returns:
      curve name string (e.g., "secp256r1")
    • jcaFactory

      public String jcaFactory()
      Returns the JCA algorithm identifier for this curve.
      Returns:
      JCA signature algorithm string
    • signFixedLength

      public int signFixedLength()
      Returns the fixed signature length for this curve in bytes.

      Lengths follow the IEEE P1363 format (raw concatenation of R and S).

      Returns:
      signature length in bytes
    • fromSignatureAlgorithmId

      public static Optional<EcdsaCurveSpec> fromSignatureAlgorithmId(String algorithmId)
      Resolves a standard external ECDSA signature algorithm identifier to the corresponding curve specification used by ZeroEcho.

      Standard names such as SHA256withECDSA imply both the digest family and the fixed-size IEEE P1363 signature layout used internally by ZeroEcho. This helper makes the mapping explicit so callers do not need to duplicate it.

      Parameters:
      algorithmId - canonical external ECDSA signature algorithm identifier
      Returns:
      matching curve specification, or Optional.empty() when the identifier is not a supported ECDSA interop name
    • description

      public String description()
      Returns a short, human-readable description of this object.

      The description should be concise and stable enough for logging or display purposes, while avoiding exposure of any sensitive information.

      Specified by:
      description in interface Describable
      Returns:
      non-null descriptive string