Class SphincsPlusKeyGenSpec
java.lang.Object
zeroecho.core.alg.sphincsplus.SphincsPlusKeyGenSpec
- All Implemented Interfaces:
AlgorithmKeySpec
Specification for generating SPHINCS+ key pairs.
SphincsPlusKeyGenSpec selects the hash family, security strength,
signature variant, and mode for the current SLH-DSA compatibility binding.
ROBUST and HARAKA remain representable for source compatibility but generation
rejects them with IllegalArgumentException; they are never remapped.
It also carries an optional provider name and explicit Bouncy Castle
parameter constant for direct mapping.
Parameters
SphincsPlusKeyGenSpec.Hash: underlying hash/XOF function (SHA2,SHAKE, orHARAKA).SphincsPlusKeyGenSpec.Security: NIST security level, expressed as128,192, or256bits.SphincsPlusKeyGenSpec.Variant: tradeoff betweenFAST(larger signatures, higher signing speed) andSMALL(shorter signatures, slower signing). Security is unaffected.SphincsPlusKeyGenSpec.Mode: onlySIMPLEis executable in this binding.providerName: JCA provider name (e.g.,"BC"for Bouncy Castle). Legacy"BCPQC"generation is rejected.explicitParamConstant: optional override; the exact field name of aSLHDSAParameterSpecconstant in the Bouncy Castle API. If non-null, it overrides automatic hash/strength/variant mapping, but cannot bypass rejection of ROBUST, HARAKA or prehash parameter constants.
Defaults
ThedefaultSpec() uses:
- Provider:
"BC" - Hash:
SphincsPlusKeyGenSpec.Hash.SHAKE - Security:
SphincsPlusKeyGenSpec.Security.L5_256 - Variant:
SphincsPlusKeyGenSpec.Variant.SMALL - Mode:
SphincsPlusKeyGenSpec.Mode.SIMPLE
Example
// Pure SLH-DSA, NIST Level 3 security, SHA-2 based
SphincsPlusKeyGenSpec spec = SphincsPlusKeyGenSpec.of(
"BC",
SphincsPlusKeyGenSpec.Hash.SHA2,
SphincsPlusKeyGenSpec.Security.L3_192,
SphincsPlusKeyGenSpec.Variant.FAST,
SphincsPlusKeyGenSpec.Mode.SIMPLE);
KeyPair kp = new SphincsPlusKeyGenBuilder().generateKeyPair(spec);
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHash function families supported by SPHINCS+.static enumLegacy construction selector.static enumSecurity levels as defined by NIST PQC (L1, L3, L5).static enumSignature variants trading performance against signature size. -
Method Summary
Modifier and TypeMethodDescriptionstatic SphincsPlusKeyGenSpecReturns the default SPHINCS+ key generation spec.Returns the explicit parameter constant override, if set.hash()Returns the hash family of this specification.mode()Returns the construction mode of this specification.static SphincsPlusKeyGenSpecof(String providerName, SphincsPlusKeyGenSpec.Hash hash, SphincsPlusKeyGenSpec.Security sec, SphincsPlusKeyGenSpec.Variant var, SphincsPlusKeyGenSpec.Mode mode) Creates a new specification with explicit algorithm parameters.Returns the provider name used for key generation.security()Returns the security level of this specification.variant()Returns the variant of this specification.Returns a copy of this specification with an explicit Bouncy Castle parameter constant override.
-
Method Details
-
defaultSpec
Returns the default SPHINCS+ key generation spec.- Returns:
- a singleton default specification (SHAKE, L5, SMALL, SIMPLE)
-
of
public static SphincsPlusKeyGenSpec of(String providerName, SphincsPlusKeyGenSpec.Hash hash, SphincsPlusKeyGenSpec.Security sec, SphincsPlusKeyGenSpec.Variant var, SphincsPlusKeyGenSpec.Mode mode) Creates a new specification with explicit algorithm parameters.- Parameters:
providerName- JCA provider name (e.g., "BC")hash- hash function familysec- security levelvar- signature variant (FAST vs SMALL)mode- construction mode (ROBUST vs SIMPLE)- Returns:
- a new
SphincsPlusKeyGenSpec
-
withExplicitParamConstant
Returns a copy of this specification with an explicit Bouncy Castle parameter constant override.This overrides automatic mapping of hash family, security and variant among the twelve pure SLH-DSA constants. It cannot bypass rejection of ROBUST, HARAKA or prehash parameters. A null name restores automatic mapping.
- Parameters:
name- the name of the static field inSLHDSAParameterSpec- Returns:
- a new
SphincsPlusKeyGenSpecwith the override
-
providerName
Returns the provider name used for key generation.- Returns:
- provider name (never
null)
-
hash
Returns the hash family of this specification.- Returns:
- hash family
-
security
Returns the security level of this specification.- Returns:
- security level
-
variant
Returns the variant of this specification.- Returns:
- signature variant
-
mode
Returns the construction mode of this specification.- Returns:
- construction mode
-
explicitParamConstant
Returns the explicit parameter constant override, if set.- Returns:
- constant name, or
nullif automatic mapping is used
-