Class HybridKexTranscript

java.lang.Object
zeroecho.sdk.hybrid.kex.HybridKexTranscript

public final class HybridKexTranscript extends Object
Canonical transcript builder for binding hybrid KEX derivation to public handshake context.

The derived hybrid keying material should be bound to protocol context to reduce risk of cross-protocol key reuse and "unknown key-share" style mistakes. This builder provides a deterministic and self-delimiting binary encoding intended to be used as HKDF info.

Encoding

The transcript is encoded as a sequence of TLV-like entries:

[u16 tagLen][tagBytes...][u32 valueLen][valueBytes...] ...

Tags are ASCII identifiers (for example "suite", "role", "peerA", "peerB", "classicMsg", "pqcMsg"). Values are arbitrary bytes. The encoding is stable across JVMs and independent of locale.

Thread safety

Instances are mutable and not thread-safe.

Since:
1.0
  • Constructor Details

    • HybridKexTranscript

      public HybridKexTranscript()
      Creates a new empty transcript.
  • Method Details

    • addUtf8

      public HybridKexTranscript addUtf8(String tag, String value)
      Adds a UTF-8 string value under a tag.
      Parameters:
      tag - ASCII tag identifier
      value - UTF-8 string value (must not be null)
      Returns:
      this transcript
      Throws:
      NullPointerException - if tag or value is null
      IllegalArgumentException - if tag is empty
    • addBytes

      public HybridKexTranscript addBytes(String tag, byte[] value)
      Adds a raw byte value under a tag.

      The value is defensively copied by the caller if needed; this method does not retain a reference to the provided array.

      Parameters:
      tag - ASCII tag identifier
      value - byte value (must not be null)
      Returns:
      this transcript
      Throws:
      NullPointerException - if tag or value is null
      IllegalArgumentException - if tag is empty
    • toByteArray

      public byte[] toByteArray()
      Returns the canonical transcript bytes (defensive copy).
      Returns:
      transcript bytes