Class MldsaKeyGenSpec

java.lang.Object
zeroecho.core.alg.mldsa.MldsaKeyGenSpec
All Implemented Interfaces:
AlgorithmKeySpec

public final class MldsaKeyGenSpec extends Object implements AlgorithmKeySpec
Specification for generating ML-DSA key pairs (FIPS 204).

ML-DSA is parameterized by a parameter set number (44/65/87). Bouncy Castle may also expose pre-hash variants (e.g., "with SHA-512") as separate parameter specs.

This spec intentionally restricts choices to the standardized ML-DSA parameter sets only.

Since:
1.0
  • Method Details

    • defaultSpec

      public static MldsaKeyGenSpec defaultSpec()
      Returns the default ML-DSA key generation spec.
      Returns:
      a singleton default specification (ML-DSA-65, no pre-hash)
    • of

      public static MldsaKeyGenSpec of(String providerName, MldsaKeyGenSpec.ParameterSet parameterSet, MldsaKeyGenSpec.PreHash preHash)
      Creates a new specification with explicit algorithm parameters.
      Parameters:
      providerName - JCA provider name (typically "BC")
      parameterSet - parameter set (44/65/87)
      preHash - optional pre-hash selection
      Returns:
      a new MldsaKeyGenSpec
    • withExplicitParamConstant

      public MldsaKeyGenSpec withExplicitParamConstant(String name)
      Returns a copy of this specification with an explicit Bouncy Castle parameter constant override.

      This bypasses automatic mapping. The name must match a static field in org.bouncycastle.jcajce.spec.MLDSAParameterSpec.

      Parameters:
      name - field name in MLDSAParameterSpec
      Returns:
      a new MldsaKeyGenSpec with the override
    • providerName

      public String providerName()
      Returns the provider name used for key generation.
      Returns:
      provider name (never null)
    • parameterSet

      public MldsaKeyGenSpec.ParameterSet parameterSet()
      Returns the ML-DSA parameter set.
      Returns:
      parameter set
    • preHash

      public MldsaKeyGenSpec.PreHash preHash()
      Returns the pre-hash selection.
      Returns:
      pre-hash selection
    • explicitParamConstant

      public String explicitParamConstant()
      Returns the explicit parameter constant override, if set.
      Returns:
      constant name, or null if automatic mapping is used