Class XWingPublicKeySpec

java.lang.Object
zeroecho.core.alg.xwing.XWingPublicKeySpec
All Implemented Interfaces:
AlgorithmKeySpec

public final class XWingPublicKeySpec extends Object implements AlgorithmKeySpec
Encoded representation of an X-Wing public key in raw format.

X-Wing uses a raw (non-DER) encoding for both public and private keys, as BouncyCastle 1.86 has no JCA/JCE provider binding for X-Wing. The raw encoding is the 1184-byte ML-KEM-768 public key followed by the 32-byte X25519 public key (1216 bytes total).

Since:
1.0
  • Constructor Details

    • XWingPublicKeySpec

      public XWingPublicKeySpec(byte[] raw)
      Constructs a new spec from raw X-Wing public key bytes.
      Parameters:
      raw - raw-encoded public key bytes
      Throws:
      NullPointerException - if raw is null
      IllegalArgumentException - if the encoding is not exactly 1216 bytes
  • Method Details

    • raw

      public byte[] raw()
      Returns a defensive copy of the raw public key bytes.
      Returns:
      raw public key bytes
    • marshal

      public static PairSeq marshal(XWingPublicKeySpec spec)
      Serializes this spec to a PairSeq.
      Parameters:
      spec - the spec to serialize
      Returns:
      serialized representation
    • unmarshal

      public static XWingPublicKeySpec unmarshal(PairSeq p)
      Deserializes a spec from a PairSeq.
      Parameters:
      p - serialized representation
      Returns:
      reconstructed spec
      Throws:
      IllegalArgumentException - if required field is missing
    • toString

      public String toString()
      Overrides:
      toString in class Object