Class EcdsaPrivateKeyBuilder
java.lang.Object
zeroecho.core.alg.ecdsa.EcdsaPrivateKeyBuilder
- All Implemented Interfaces:
PrivateKeyImporter<EcdsaPrivateKeySpec>
public final class EcdsaPrivateKeyBuilder
extends Object
implements PrivateKeyImporter<EcdsaPrivateKeySpec>
ECDSA Private Key Builder
Implementation ofPrivateKeyImporter for
EcdsaPrivateKeySpec. This builder is responsible for importing ECDSA
private keys from encoded representations.
The exact supported operation is importPrivate(EcdsaPrivateKeySpec).
Generation and public import are registered through their own
operation-specific implementations.
Encoding
TheEcdsaPrivateKeySpec stores the private key in
PKCS#8 DER format. This builder delegates to a JCA KeyFactory for the
"EC" algorithm to reconstruct a usable PrivateKey.
Usage
Typically accessed through the session key-operation API orCryptoAlgorithm.privateKeyImporter(Class).
// Example: Import an ECDSA private key
byte[] pkcs8 = ...; // load PKCS#8 DER data
EcdsaPrivateKeySpec spec = new EcdsaPrivateKeySpec(pkcs8);
PrivateKey priv = new EcdsaPrivateKeyBuilder().importPrivate(spec);
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a stateless PKCS#8 EC private-key importer. -
Method Summary
Modifier and TypeMethodDescriptionImports a private key from a PKCS#8 encoded specification.
-
Constructor Details
-
EcdsaPrivateKeyBuilder
public EcdsaPrivateKeyBuilder()Creates a stateless PKCS#8 EC private-key importer.
-
-
Method Details
-
importPrivate
Imports a private key from a PKCS#8 encoded specification.Uses a JCA
KeyFactoryinstance for"EC"to parse the givenEcdsaPrivateKeySpecand construct aPrivateKey.- Specified by:
importPrivatein interfacePrivateKeyImporter<EcdsaPrivateKeySpec>- Parameters:
spec- private key specification containing PKCS#8 DER encoding- Returns:
- reconstructed
PrivateKeyinstance - Throws:
GeneralSecurityException- if the encoding is invalid or the key cannot be reconstructed
-