Package zeroecho.core.alg.dh
package zeroecho.core.alg.dh
Diffie-Hellman (DH) algorithm integration.
This package provides the core support for Diffie-Hellman key agreement within the ZeroEcho framework. It includes the algorithm descriptor, a builder for generating key pairs, immutable parameter specifications, and encoded key specs for import/export. The implementation favors use of standardized RFC 7919 finite-field DH groups and encapsulates JCA interoperability.
Scope and responsibilities
- Register the DH algorithm with a canonical identifier and declare its
KeyUsage.AGREEMENTcapability. - Provide a builder for generating key pairs from known parameter sets or ad-hoc parameter generation.
- Expose predefined RFC 7919 FFDHE groups for safe parameter selection.
- Allow import/export of encoded keys via defensively copying key specs supporting PKCS#8 and X.509; private-key specs are destroyable.
Components
- DhAlgorithm: registers the algorithm under id
"DH", binds agreement contexts to the JCA"DiffieHellman"implementation, and wires key builders. - DhKeyGenBuilder: generates key pairs using
AlgorithmParameterGeneratoror suppliedDHParameterSpecinstances. - DhSpec: immutable container for DH parameters; provides static factories for FFDHE groups (2048–8192 bits).
- DhPublicKeySpec and DhPrivateKeySpec: encoded key specs for
importing/exporting X.509 and PKCS#8 encodings, with
PairSeqmarshalling support; the private-key form is destroyable.
Design notes
- Algorithm descriptors are immutable and thread-safe for reuse.
- Builders are stateless; contexts produced for key agreement are not thread-safe and should be used per operation.
- Use of standardized groups is strongly recommended over ad-hoc parameter generation for interoperability and safety.
- Since:
- 1.0
-
ClassesClassDescriptionDiffie-Hellman algorithm registration for use in the pluggable cryptography catalog.DH key pair builderKey specification for a Diffie-Hellman private key encoded in PKCS#8 format.Key specification for a Diffie-Hellman public key encoded in X.509 format.Diffie-Hellman parameter specification