Class EcdsaKeyGenBuilder
java.lang.Object
zeroecho.core.alg.ecdsa.EcdsaKeyGenBuilder
- All Implemented Interfaces:
AsymmetricKeyPairGenerator<EcdsaCurveSpec>
public final class EcdsaKeyGenBuilder
extends Object
implements AsymmetricKeyPairGenerator<EcdsaCurveSpec>
ECDSA Key Pair Generator
Implementation ofAsymmetricKeyPairGenerator for
EcdsaCurveSpec. This builder is responsible for generating new
elliptic curve key pairs for use with the EcdsaAlgorithm.
The exact supported operation is generateKeyPair(EcdsaCurveSpec).
Public and private import are registered separately through
EcdsaPublicKeyBuilder and EcdsaPrivateKeyBuilder.
Usage
Typically accessed through the session key-operation API orCryptoAlgorithm.asymmetricKeyPairGenerator(Class).
// Example: Generate an ECDSA P-256 key pair
EcdsaCurveSpec spec = EcdsaCurveSpec.P256;
KeyPair kp = new EcdsaKeyGenBuilder().generateKeyPair(spec);
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGenerates a new elliptic curve key pair for the given curve specification.
-
Constructor Details
-
EcdsaKeyGenBuilder
public EcdsaKeyGenBuilder()Creates a stateless ECDSA key-pair generator.
-
-
Method Details
-
generateKeyPair
Generates a new elliptic curve key pair for the given curve specification.Internally uses the JCA
KeyPairGeneratorwith the"EC"algorithm and initializes it with anECGenParameterSpeccorresponding to the curve name (e.g.,"secp256r1").- Specified by:
generateKeyPairin interfaceAsymmetricKeyPairGenerator<EcdsaCurveSpec>- Parameters:
spec- the curve specification to use- Returns:
- newly generated EC
KeyPair - Throws:
GeneralSecurityException- if the curve is not supported by the provider
-