Class AbstractEdDSAKeyGenBuilder<S extends AlgorithmKeySpec>

java.lang.Object
zeroecho.core.alg.common.eddsa.AbstractEdDSAKeyGenBuilder<S>
Type Parameters:
S - the algorithm-specific AlgorithmKeySpec subtype
All Implemented Interfaces:
AsymmetricKeyPairGenerator<S>
Direct Known Subclasses:
Ed25519KeyGenBuilder, Ed448KeyGenBuilder

public abstract class AbstractEdDSAKeyGenBuilder<S extends AlgorithmKeySpec> extends Object implements AsymmetricKeyPairGenerator<S>

Abstract EdDSA Key-Pair Builder

Base class for key generation builders targeting Edwards-curve Digital Signature Algorithm (EdDSA) variants such as Ed25519 and Ed448.

This class integrates with the JCA KeyPairGenerator by exposing the correct algorithm name (e.g., "Ed25519" or "Ed448"). Concrete subclasses provide this algorithm identifier via jcaKeyPairAlg().

Responsibilities

  • Expose a template method jcaKeyPairAlg() to return the canonical JCA algorithm identifier.
  • Generate key pairs using JCA without requiring extra parameters.
  • Intentionally reject public and private key imports, as those are delegated to the corresponding *KeySpec builders.

Thread-safety

Instances are stateless. Each call to generateKeyPair(AlgorithmKeySpec) acquires a new KeyPairGenerator, so builders are safe for concurrent use.
Since:
1.0
  • Constructor Details

    • AbstractEdDSAKeyGenBuilder

      public AbstractEdDSAKeyGenBuilder()
      Creates a stateless EdDSA key-pair generator base.
  • Method Details

    • jcaKeyPairAlg

      protected abstract String jcaKeyPairAlg()
      Returns the JCA algorithm name understood by KeyPairGenerator.

      Implementations must return the canonical algorithm string supported by the JDK, e.g.:

      • "Ed25519"
      • "Ed448"
      Returns:
      the JCA algorithm identifier string
    • generateKeyPair

      public KeyPair generateKeyPair(S spec) throws GeneralSecurityException
      Generates a new EdDSA key pair using JCA defaults.

      The provided spec is not inspected in this base implementation. Subclasses may extend this behavior to interpret specification parameters.

      Specified by:
      generateKeyPair in interface AsymmetricKeyPairGenerator<S extends AlgorithmKeySpec>
      Parameters:
      spec - algorithm-specific key specification (currently unused)
      Returns:
      a fresh KeyPair for the chosen EdDSA variant
      Throws:
      GeneralSecurityException - if the JCA provider does not support the specified EdDSA algorithm