Package zeroecho.core.alg.sphincsplus
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 SPHINCS+ post-quantum signature scheme.
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(smaller signatures, higher signing speed) andSMALL(shorter signatures, slower signing). Security is unaffected.SphincsPlusKeyGenSpec.Mode:ROBUST(conservative construction) orSIMPLE(more efficient, narrower assumptions).providerName: JCA provider name (e.g.,"BCPQC"for Bouncy Castle PQC).explicitParamConstant: optional override; the exact field name of aSPHINCSPlusParameterSpecconstant in the Bouncy Castle API. If non-null, it bypasses the automatic mapping.
Defaults
ThedefaultSpec() uses:
- Provider:
"BCPQC" - Hash:
SphincsPlusKeyGenSpec.Hash.SHAKE - Security:
SphincsPlusKeyGenSpec.Security.L5_256 - Variant:
SphincsPlusKeyGenSpec.Variant.SMALL - Mode:
SphincsPlusKeyGenSpec.Mode.ROBUST
Example
// Conservative, NIST Level 3 security, SHA-2 based
SphincsPlusKeyGenSpec spec = SphincsPlusKeyGenSpec.of(
"BCPQC",
SphincsPlusKeyGenSpec.Hash.SHA2,
SphincsPlusKeyGenSpec.Security.L3_192,
SphincsPlusKeyGenSpec.Variant.FAST,
SphincsPlusKeyGenSpec.Mode.ROBUST);
KeyPair kp = new SphincsPlusKeyGenBuilder().generateKeyPair(spec);
- Since:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHash function families supported by SPHINCS+.static enumConstruction mode: conservativeROBUSTvs.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, ROBUST)
-
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., "BCPQC")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 bypasses automatic mapping of hash family, security, variant, and mode. It is useful to test new or provider-specific constants.
- Parameters:
name- the name of the static field inSPHINCSPlusParameterSpec- 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
-