Class MldsaPublicKeySpec
java.lang.Object
zeroecho.core.alg.mldsa.MldsaPublicKeySpec
- All Implemented Interfaces:
AlgorithmKeySpec
Encoded representation of an ML-DSA public key.
MldsaPublicKeySpec is an immutable value object that wraps an X.509
(SubjectPublicKeyInfo) encoded ML-DSA public key together with the JCA
provider name that should be used when importing the key.
Encoding
- The public key bytes are stored as a defensive copy of the provided X.509 byte array.
- Marshalling/unmarshalling uses
PairSeqwith Base64 encoding under"x509.b64".
Provider selection
The default provider is "BC".
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionMldsaPublicKeySpec(byte[] encodedX509) Creates a new specification using the default provider"BC".MldsaPublicKeySpec(byte[] encodedX509, String providerName) Creates a new specification using the supplied provider. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]encoded()Returns a defensive copy of the X.509-encoded public key bytes.static PairSeqmarshal(MldsaPublicKeySpec spec) Serializes the given spec into aPairSeq.Returns the provider name associated with this specification.static MldsaPublicKeySpecDeserializes aMldsaPublicKeySpecfrom aPairSeq.
-
Constructor Details
-
MldsaPublicKeySpec
public MldsaPublicKeySpec(byte[] encodedX509) Creates a new specification using the default provider"BC".- Parameters:
encodedX509- X.509-encoded ML-DSA public key bytes- Throws:
IllegalArgumentException- ifencodedX509isnull
-
MldsaPublicKeySpec
Creates a new specification using the supplied provider.- Parameters:
encodedX509- X.509-encoded ML-DSA public key bytesproviderName- JCA provider name to use for import; may benull- Throws:
IllegalArgumentException- ifencodedX509isnull
-
-
Method Details
-
encoded
public byte[] encoded()Returns a defensive copy of the X.509-encoded public key bytes.- Returns:
- a copy of the encoded public key
-
providerName
Returns the provider name associated with this specification.- Returns:
- provider name, never
null
-
marshal
Serializes the given spec into aPairSeq.- Parameters:
spec- the public key specification to serialize- Returns:
- serialized representation
- Throws:
NullPointerException- ifspecisnull
-
unmarshal
Deserializes aMldsaPublicKeySpecfrom aPairSeq.- Parameters:
p- serialized input- Returns:
- reconstructed public key specification
- Throws:
IllegalArgumentException- if"x509.b64"is missingNullPointerException- ifpisnull
-