Class SphincsPlusPublicKeyBuilder
java.lang.Object
zeroecho.core.alg.sphincsplus.SphincsPlusPublicKeyBuilder
- All Implemented Interfaces:
PublicKeyImporter<SphincsPlusPublicKeySpec>
public final class SphincsPlusPublicKeyBuilder
extends Object
implements PublicKeyImporter<SphincsPlusPublicKeySpec>
Builder for importing SPHINCS+ public keys from encoded specifications.
SphincsPlusPublicKeyBuilder integrates with the JCA
KeyFactory to parse X.509-encoded SPHINCS+ public keys. Unlike
SphincsPlusKeyGenBuilder, this builder does not generate new key
pairs, but focuses solely on importing public key material.
The exact supported operation is
importPublic(SphincsPlusPublicKeySpec). Other key operations are
registered through their own exact interfaces.
Example
// Assuming bytes contain an X.509-encoded SPHINCS+ public key:
SphincsPlusPublicKeySpec spec =
new SphincsPlusPublicKeySpec(encodedBytes, "BC");
PublicKey pub =
new SphincsPlusPublicKeyBuilder().importPublic(spec);
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a stateless SPHINCS+ public-key importer. -
Method Summary
Modifier and TypeMethodDescriptionImports a SPHINCS+ public key from X.509 encoding.
-
Constructor Details
-
SphincsPlusPublicKeyBuilder
public SphincsPlusPublicKeyBuilder()Creates a stateless SPHINCS+ public-key importer.
-
-
Method Details
-
importPublic
Imports a SPHINCS+ public key from X.509 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:
importPublicin interfacePublicKeyImporter<SphincsPlusPublicKeySpec>- Parameters:
spec- public key specification containing X.509-encoded key material and optional provider name- Returns:
- the imported SPHINCS+
PublicKey - Throws:
NullPointerException- ifspecor its encoded bytes are nullGeneralSecurityException- if the key factory cannot be initialized or the encoded key is invalid
-