Class SphincsPlusPrivateKeyBuilder
java.lang.Object
zeroecho.core.alg.sphincsplus.SphincsPlusPrivateKeyBuilder
- All Implemented Interfaces:
PrivateKeyImporter<SphincsPlusPrivateKeySpec>
public final class SphincsPlusPrivateKeyBuilder
extends Object
implements PrivateKeyImporter<SphincsPlusPrivateKeySpec>
Builder for importing SPHINCS+ private keys from encoded specifications.
SphincsPlusPrivateKeyBuilder integrates with the JCA
KeyFactory to parse PKCS#8-encoded SPHINCS+ private keys. Unlike
SphincsPlusKeyGenBuilder, this builder does not generate new key
pairs but focuses solely on importing private key material.
The exact supported operation is
importPrivate(SphincsPlusPrivateKeySpec). Other key operations are
registered through their own exact interfaces.
Example
// Assuming bytes contain a PKCS#8-encoded SPHINCS+ private key:
SphincsPlusPrivateKeySpec spec =
new SphincsPlusPrivateKeySpec(encodedBytes, "BC");
PrivateKey priv =
new SphincsPlusPrivateKeyBuilder().importPrivate(spec);
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a stateless SPHINCS+ private-key importer. -
Method Summary
Modifier and TypeMethodDescriptionImports a SPHINCS+ private key from PKCS#8 encoding.
-
Constructor Details
-
SphincsPlusPrivateKeyBuilder
public SphincsPlusPrivateKeyBuilder()Creates a stateless SPHINCS+ private-key importer.
-
-
Method Details
-
importPrivate
Imports a SPHINCS+ private key from PKCS#8 encoding.The method uses
KeyFactorywith algorithm"SLH-DSA"and the provider specified in thespec. If no provider name is given, the default provider resolution is used.- Specified by:
importPrivatein interfacePrivateKeyImporter<SphincsPlusPrivateKeySpec>- Parameters:
spec- private key specification containing PKCS#8-encoded key material and optional provider name- Returns:
- the imported SPHINCS+
PrivateKey - Throws:
NullPointerException- ifspecor its encoded bytes are nullGeneralSecurityException- if the key factory cannot be initialized or the encoded key is invalid
-