Package zeroecho.core.alg.ecdsa


package zeroecho.core.alg.ecdsa
Elliptic Curve Digital Signature Algorithm (ECDSA) integration.

This package provides the ECDSA algorithm descriptor, curve specifications, key builders for generation and import, and defensively copying encoded key specs. It wires ECDSA into the core signature SPI through a JCA-backed streaming signature context that enforces fixed signature lengths.

Scope and responsibilities

  • Register ECDSA under a canonical identifier and declare its KeyUsage.SIGN and KeyUsage.VERIFY roles.
  • Expose curve specifications for NIST P-256, P-384, and P-521 with canonical curve names, JCA algorithm identifiers, and fixed tag lengths.
  • Provide key builders for generating EC key pairs and importing X.509/PKCS#8 encodings.
  • Adapt JCA Signature engines to the core streaming context model with strict length enforcement.

Components

  • EcdsaAlgorithm: registers the algorithm, declares sign/verify capabilities, and wires EC key builders and specs.
  • EcdsaCurveSpec: enum of supported curves (P-256, P-384, P-521) with curve names, JCA identifiers, and deterministic signature lengths.
  • EcdsaKeyGenBuilder: generates EC key pairs for the chosen curve using KeyPairGenerator with ECGenParameterSpec.
  • EcdsaPublicKeyBuilder and EcdsaPrivateKeyBuilder: import keys from X.509 and PKCS#8 encodings via KeyFactory.
  • EcdsaPublicKeySpec and EcdsaPrivateKeySpec: wrappers around encoded keys with marshalling support; the private-key form is destroyable.

Design notes

  • Algorithm descriptors are immutable and thread-safe; signature contexts are stateful and not thread-safe.
  • Unsupported directions in key builders (e.g., generating from an import spec) fail fast with clear exceptions.
  • Signatures are always encoded in IEEE P1363 format (R and S concatenated) with deterministic lengths.
Since:
1.0