Class SphincsPlusKeyGenBuilder
- All Implemented Interfaces:
AsymmetricKeyPairGenerator<SphincsPlusKeyGenSpec>
SphincsPlusKeyGenBuilder integrates with the Bouncy Castle BC
provider to generate pure SLH-DSA key pairs. It maps high-level
SphincsPlusKeyGenSpec parameters (hash family, security level,
variant, and mode) to the appropriate
org.bouncycastle.jcajce.spec.SLHDSAParameterSpec constant.
Reflection is used to avoid a hard dependency on all parameter variants.
The exact supported operation is
generateKeyPair(SphincsPlusKeyGenSpec). Public and private import
are registered separately for SphincsPlusPublicKeySpec and
SphincsPlusPrivateKeySpec.
Example
SphincsPlusKeyGenSpec spec =
SphincsPlusKeyGenSpec.of("BC", SphincsPlusKeyGenSpec.Hash.SHA2,
SphincsPlusKeyGenSpec.Security.L1_128, SphincsPlusKeyGenSpec.Variant.SMALL,
SphincsPlusKeyGenSpec.Mode.SIMPLE);
KeyPair kp = new SphincsPlusKeyGenBuilder().generateKeyPair(spec);
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGenerates a pure SLH-DSA key pair for the SPHINCS+ compatibility binding.
-
Constructor Details
-
SphincsPlusKeyGenBuilder
public SphincsPlusKeyGenBuilder()Creates a stateless SPHINCS+ key-pair generator.
-
-
Method Details
-
generateKeyPair
Generates a pure SLH-DSA key pair for the SPHINCS+ compatibility binding.The method resolves the corresponding Bouncy Castle
SLHDSAParameterSpecconstant via reflection and initializes aKeyPairGenerator. IfSphincsPlusKeyGenSpec.providerName()is non-null, the generator is obtained from that provider.- Specified by:
generateKeyPairin interfaceAsymmetricKeyPairGenerator<SphincsPlusKeyGenSpec>- Parameters:
spec- the key generation specification, including hash family, security level, variant, and mode- Returns:
- a freshly generated SPHINCS+
KeyPair - Throws:
NullPointerException- ifspecisnullIllegalArgumentException- if ROBUST, HARAKA, BCPQC or an unsupported explicit parameter constant is requestedGeneralSecurityException- if the parameter spec cannot be resolved or if the provider fails to generate a key pair
-