Class XdhKeyGenBuilder

java.lang.Object
zeroecho.core.alg.xdh.XdhKeyGenBuilder
All Implemented Interfaces:
AsymmetricKeyBuilder<XdhSpec>

public final class XdhKeyGenBuilder extends Object implements AsymmetricKeyBuilder<XdhSpec>
KeyPair generator for XDH curves using the JCA KeyPairGenerator SPI.

This builder produces XDH key pairs (e.g., X25519, X448 depending on the runtime provider) by instantiating a JCA KeyPairGenerator with the algorithm name supplied by XdhSpec.kpgName().

Design and scope

  • Generation only: This builder supports key generation. Public/private import is intentionally unsupported and will throw UnsupportedOperationException.
  • Provider resolution: The default JCA provider selection is used. If a specific provider is required, supply or register one that exposes the requested XDH algorithm name.
  • Thread-safety: Instances are stateless and thread-safe.

Example


 // Generate an X25519 key pair
 XdhKeyGenBuilder builder = new XdhKeyGenBuilder();
 KeyPair kp = builder.generateKeyPair(XdhSpec.X25519);
 PublicKey pub = kp.getPublic();
 PrivateKey prv = kp.getPrivate();
 
Since:
1.0
  • Constructor Details

    • XdhKeyGenBuilder

      public XdhKeyGenBuilder()
  • Method Details