Class EcdsaPublicKeyBuilder
java.lang.Object
zeroecho.core.alg.ecdsa.EcdsaPublicKeyBuilder
- All Implemented Interfaces:
PublicKeyImporter<EcdsaPublicKeySpec>
public final class EcdsaPublicKeyBuilder
extends Object
implements PublicKeyImporter<EcdsaPublicKeySpec>
ECDSA Public Key Builder
Implementation ofPublicKeyImporter for
EcdsaPublicKeySpec. This builder is responsible for importing ECDSA
public keys from X.509 SubjectPublicKeyInfo encodings.
The exact supported operation is importPublic(EcdsaPublicKeySpec).
Generation and private import are registered through their own
operation-specific implementations.
Encoding
TheEcdsaPublicKeySpec stores the public key in
standard X.509 DER format. This builder delegates to a JCA KeyFactory
for the "EC" algorithm to reconstruct a usable PublicKey.
Usage
Typically accessed through the session key-operation API orCryptoAlgorithm.publicKeyImporter(Class).
// Example: Import an ECDSA public key
byte[] x509 = ...; // load SubjectPublicKeyInfo DER data
EcdsaPublicKeySpec spec = new EcdsaPublicKeySpec(x509);
PublicKey pub = new EcdsaPublicKeyBuilder().importPublic(spec);
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionImports a public key from an X.509 SubjectPublicKeyInfo specification.
-
Constructor Details
-
EcdsaPublicKeyBuilder
public EcdsaPublicKeyBuilder()Creates a stateless X.509 EC public-key importer.
-
-
Method Details
-
importPublic
Imports a public key from an X.509 SubjectPublicKeyInfo specification.Uses a JCA
KeyFactoryinstance for"EC"to parse the givenEcdsaPublicKeySpecand construct aPublicKey.- Specified by:
importPublicin interfacePublicKeyImporter<EcdsaPublicKeySpec>- Parameters:
spec- public key specification containing X.509 DER encoding- Returns:
- reconstructed
PublicKeyinstance - Throws:
GeneralSecurityException- if the encoding is invalid or the key cannot be reconstructed
-