Class LmsPrivateKeySpec
java.lang.Object
zeroecho.core.alg.lms.LmsPrivateKeySpec
- All Implemented Interfaces:
Destroyable, AlgorithmKeySpec
Encoded representation of an LMS private key in PKCS#8 format.
LMS private keys are stateful with a finite signing
capacity. The PKCS#8 encoding captures the current leaf-index state.
Callers must persist the updated key state after every signing operation to
prevent key-state reuse. See LmsSignatureContext for lifecycle
guidance.
This class implements Destroyable to allow zeroing of key material
when the spec is no longer needed.
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionLmsPrivateKeySpec(byte[] pkcs8Der) Constructs a new spec from PKCS#8 DER encoded LMS private key bytes. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()booleanstatic PairSeqmarshal(LmsPrivateKeySpec spec) Serializes this spec to aPairSeq.byte[]pkcs8()Returns a defensive copy of the PKCS#8 encoded key bytes.toString()static LmsPrivateKeySpecDeserializes a spec from aPairSeq.
-
Constructor Details
-
LmsPrivateKeySpec
public LmsPrivateKeySpec(byte[] pkcs8Der) Constructs a new spec from PKCS#8 DER encoded LMS private key bytes.- Parameters:
pkcs8Der- PKCS#8 DER bytes- Throws:
NullPointerException- ifpkcs8Deris null
-
-
Method Details
-
pkcs8
public byte[] pkcs8()Returns a defensive copy of the PKCS#8 encoded key bytes.- Returns:
- PKCS#8 DER bytes
- Throws:
IllegalStateException- if this spec has been destroyed
-
marshal
Serializes this spec to aPairSeq.- Parameters:
spec- the spec to serialize- Returns:
- serialized representation
-
unmarshal
Deserializes a spec from aPairSeq.- Parameters:
p- serialized representation- Returns:
- reconstructed spec
- Throws:
IllegalArgumentException- if required field is missing
-
destroy
public void destroy()- Specified by:
destroyin interfaceDestroyable
-
isDestroyed
public boolean isDestroyed()- Specified by:
isDestroyedin interfaceDestroyable
-
toString
-