Class Ed25519PrivateKeyBuilder
java.lang.Object
zeroecho.core.alg.common.eddsa.AbstractEncodedPrivateKeyBuilder<Ed25519PrivateKeySpec>
zeroecho.core.alg.ed25519.Ed25519PrivateKeyBuilder
- All Implemented Interfaces:
PrivateKeyImporter<Ed25519PrivateKeySpec>
public final class Ed25519PrivateKeyBuilder
extends AbstractEncodedPrivateKeyBuilder<Ed25519PrivateKeySpec>
Private key builder for Ed25519
ConcretePrivateKeyImporter for importing wrapping
Ed25519 private keys.
This builder integrates with the JCA under the canonical key factory
algorithm name "Ed25519". It consumes an
Ed25519PrivateKeySpec, which provides the encoded PKCS#8
representation of the private key.
Responsibilities
- Expose the JCA key factory name
"Ed25519"for interoperability. - Provide the encoded PKCS#8 bytes via
Ed25519PrivateKeySpec.encoded()for key material import.
Usage example
// Import a private key from its encoded PKCS#8 form
Ed25519PrivateKeySpec spec = new Ed25519PrivateKeySpec(pkcs8Bytes);
PrivateKey privateKey = session.keyBuilders().asymmetric().importPrivate("Ed25519", spec);
Thread-safety
Instances of this builder are stateless and may be reused safely across threads.- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a stateless Ed25519 private-key importer. -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]Returns the PKCS#8 encoded bytes from the given key spec.protected StringReturns the canonical JCA algorithm name for Ed25519 key factories.Methods inherited from class AbstractEncodedPrivateKeyBuilder
importPrivate
-
Constructor Details
-
Ed25519PrivateKeyBuilder
public Ed25519PrivateKeyBuilder()Creates a stateless Ed25519 private-key importer.
-
-
Method Details
-
jcaKeyFactoryAlg
Returns the canonical JCA algorithm name for Ed25519 key factories.This value is used by the parent
AbstractEncodedPrivateKeyBuilderto obtain aKeyFactory.- Specified by:
jcaKeyFactoryAlgin classAbstractEncodedPrivateKeyBuilder<Ed25519PrivateKeySpec>- Returns:
- the string
"Ed25519"
-
encodedPkcs8
Returns the PKCS#8 encoded bytes from the given key spec.This encoding is passed to the JCA
KeyFactoryfor parsing into aPrivateKeyinstance.- Specified by:
encodedPkcs8in classAbstractEncodedPrivateKeyBuilder<Ed25519PrivateKeySpec>- Parameters:
spec- the private key specification holding the PKCS#8 encoding- Returns:
- a defensive copy of the PKCS#8-encoded key bytes
-