Class AbstractEdDSAKeyGenBuilder<S extends AlgorithmKeySpec>
java.lang.Object
zeroecho.core.alg.common.eddsa.AbstractEdDSAKeyGenBuilder<S>
- Type Parameters:
S- the algorithm-specificAlgorithmKeySpecsubtype
- 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
*KeySpecbuilders.
Thread-safety
Instances are stateless. Each call togenerateKeyPair(AlgorithmKeySpec) acquires a new
KeyPairGenerator, so builders are safe for concurrent use.- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a stateless EdDSA key-pair generator base. -
Method Summary
Modifier and TypeMethodDescriptiongenerateKeyPair(S spec) Generates a new EdDSA key pair using JCA defaults.protected abstract StringReturns the JCA algorithm name understood byKeyPairGenerator.
-
Constructor Details
-
AbstractEdDSAKeyGenBuilder
public AbstractEdDSAKeyGenBuilder()Creates a stateless EdDSA key-pair generator base.
-
-
Method Details
-
jcaKeyPairAlg
Returns the JCA algorithm name understood byKeyPairGenerator.Implementations must return the canonical algorithm string supported by the JDK, e.g.:
"Ed25519""Ed448"
- Returns:
- the JCA algorithm identifier string
-
generateKeyPair
Generates a new EdDSA key pair using JCA defaults.The provided
specis not inspected in this base implementation. Subclasses may extend this behavior to interpret specification parameters.- Specified by:
generateKeyPairin interfaceAsymmetricKeyPairGenerator<S extends AlgorithmKeySpec>- Parameters:
spec- algorithm-specific key specification (currently unused)- Returns:
- a fresh
KeyPairfor the chosen EdDSA variant - Throws:
GeneralSecurityException- if the JCA provider does not support the specified EdDSA algorithm
-