Class XWingPrivateKeySpec
java.lang.Object
zeroecho.core.alg.xwing.XWingPrivateKeySpec
- All Implemented Interfaces:
Destroyable, AlgorithmKeySpec
Encoded representation of an X-Wing private key as its 32-byte seed.
X-Wing uses a raw seed encoding for private keys (no DER/PKCS#8), as
BouncyCastle 1.86 has no JCA/JCE provider binding for X-Wing. The seed
allows deterministic reconstruction of the full X-Wing private key via
XWingPrivateKeyParameters.
This class implements Destroyable to allow zeroing of key material
when the spec is no longer needed.
- Since:
- 1.0
-
Constructor Summary
ConstructorsConstructorDescriptionXWingPrivateKeySpec(byte[] seed) Constructs a new spec from a raw X-Wing private key seed. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()booleanstatic PairSeqmarshal(XWingPrivateKeySpec spec) Serializes this spec to aPairSeq.byte[]rawSeed()Returns a defensive copy of the raw seed bytes.toString()static XWingPrivateKeySpecDeserializes a spec from aPairSeq.
-
Constructor Details
-
XWingPrivateKeySpec
public XWingPrivateKeySpec(byte[] seed) Constructs a new spec from a raw X-Wing private key seed.- Parameters:
seed- 32-byte private key seed- Throws:
NullPointerException- ifseedis nullIllegalArgumentException- if the seed is not exactly 32 bytes
-
-
Method Details
-
rawSeed
public byte[] rawSeed()Returns a defensive copy of the raw seed bytes.- Returns:
- seed 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
-